Stricter Thread<> interface
Implements a Thread<>::invoke interface that only permits calling member functions with bound arguments. Also introduce invokeWithResult, which accepts a callback and invokes it, passing the result, on the invoking thread's RunLoop. This closes the loop of two evented threads doing message passing.
This commit is contained in:
@@ -3,6 +3,28 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
|
||||
|
||||
int uv_key_create(uv_key_t* key) {
|
||||
return -pthread_key_create(key, NULL);
|
||||
}
|
||||
|
||||
void uv_key_delete(uv_key_t* key) {
|
||||
if (pthread_key_delete(*key))
|
||||
abort();
|
||||
}
|
||||
|
||||
void* uv_key_get(uv_key_t* key) {
|
||||
return pthread_getspecific(*key);
|
||||
}
|
||||
|
||||
void uv_key_set(uv_key_t* key, void* value) {
|
||||
if (pthread_setspecific(*key, value))
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
namespace uv {
|
||||
|
||||
std::string cwd() {
|
||||
|
||||
Reference in New Issue
Block a user