Commit edcd0b99 authored by Max Kellermann's avatar Max Kellermann

lib/curl/Request: add methods StartIndirect(), StopIndirect()

parent 55d14739
......@@ -32,6 +32,7 @@
#include "Global.hxx"
#include "Version.hxx"
#include "Handler.hxx"
#include "event/Call.hxx"
#include "util/RuntimeError.hxx"
#include "util/StringStrip.hxx"
#include "util/StringView.hxx"
......@@ -81,6 +82,14 @@ CurlRequest::Start()
}
void
CurlRequest::StartIndirect()
{
BlockingCall(global.GetEventLoop(), [this](){
Start();
});
}
void
CurlRequest::Stop() noexcept
{
if (!registered)
......@@ -91,6 +100,14 @@ CurlRequest::Stop() noexcept
}
void
CurlRequest::StopIndirect()
{
BlockingCall(global.GetEventLoop(), [this](){
Stop();
});
}
void
CurlRequest::FreeEasy() noexcept
{
if (!easy)
......
......@@ -94,12 +94,22 @@ public:
void Start();
/**
* A thread-safe version of Start().
*/
void StartIndirect();
/**
* Unregister this request via CurlGlobal::Remove().
*
* This method must be called in the event loop thread.
*/
void Stop() noexcept;
/**
* A thread-safe version of Stop().
*/
void StopIndirect();
CURL *Get() noexcept {
return easy.Get();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment