Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

darwin: assume CFRunLoopStop() isn't thread-safe #800

Merged
merged 1 commit into from May 17, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/unix/darwin.c
Expand Up @@ -84,9 +84,8 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
uv__cf_loop_signal_t* s;

assert(loop->cf_loop != NULL);
CFRunLoopStop(loop->cf_loop);
uv__cf_loop_signal(loop, NULL, NULL);
uv_thread_join(&loop->cf_thread);
loop->cf_loop = NULL;

uv_sem_destroy(&loop->cf_sem);
uv_mutex_destroy(&loop->cf_mutex);
Expand Down Expand Up @@ -145,7 +144,12 @@ void uv__cf_loop_cb(void* arg) {
item = ngx_queue_head(&split_head);

s = ngx_queue_data(item, uv__cf_loop_signal_t, member);
s->cb(s->arg);

/* This was a termination signal */
if (s->cb == NULL)
CFRunLoopStop(loop->cf_loop);
else
s->cb(s->arg);

ngx_queue_remove(item);
free(s);
Expand Down