diff options
Diffstat (limited to '')
-rw-r--r-- | src/IOThread.cxx | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/IOThread.cxx b/src/IOThread.cxx index ef0cec4d6..cba9c9263 100644 --- a/src/IOThread.cxx +++ b/src/IOThread.cxx @@ -115,53 +115,3 @@ io_thread_inside(void) { return io.thread != NULL && g_thread_self() == io.thread; } - -struct call_data { - GThreadFunc function; - gpointer data; - bool done; - gpointer result; -}; - -static gboolean -io_thread_call_func(gpointer _data) -{ - struct call_data *data = (struct call_data *)_data; - - gpointer result = data->function(data->data); - - io.mutex.lock(); - data->done = true; - data->result = result; - io.cond.broadcast(); - io.mutex.unlock(); - - return false; -} - -gpointer -io_thread_call(GThreadFunc function, gpointer _data) -{ - assert(io.thread != NULL); - - if (io_thread_inside()) - /* we're already in the I/O thread - no - synchronization needed */ - return function(_data); - - struct call_data data = { - function, - _data, - false, - nullptr, - }; - - io.loop->AddIdle(io_thread_call_func, &data); - - io.mutex.lock(); - while (!data.done) - io.cond.wait(io.mutex); - io.mutex.unlock(); - - return data.result; -} |