Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 321e09e585
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (28 sloc) 0.87 kb
#include "ffi.h"
ThreadedCallbackInvokation::ThreadedCallbackInvokation(CallbackInfo *cbinfo, void *retval, void **parameters)
{
m_cbinfo = cbinfo;
m_retval = retval;
m_parameters = parameters;
pthread_mutex_init(&m_mutex, NULL);
pthread_cond_init(&m_cond, NULL);
ev_ref(EV_DEFAULT_UC_); // hold the event loop open while this is executing
}
ThreadedCallbackInvokation::~ThreadedCallbackInvokation()
{
ev_unref(EV_DEFAULT_UC_);
pthread_cond_destroy(&m_cond);
pthread_mutex_destroy(&m_mutex);
}
void ThreadedCallbackInvokation::SignalDoneExecuting()
{
pthread_mutex_lock(&m_mutex);
pthread_cond_signal(&m_cond);
pthread_mutex_unlock(&m_mutex);
}
void ThreadedCallbackInvokation::WaitForExecution()
{
pthread_mutex_lock(&m_mutex);
pthread_cond_wait(&m_cond, &m_mutex);
pthread_mutex_unlock(&m_mutex);
}
Jump to Line
Something went wrong with that request. Please try again.