Lines Matching refs:loop
39 void uv__fsevents_loop_delete(uv_loop_t* loop) { in uv__fsevents_loop_delete() argument
95 CFRunLoopRef loop; member
108 static int uv__cf_loop_signal(uv_loop_t* loop,
228 uv_loop_t* loop; in uv__fsevents_event_cb() local
234 loop = info; in uv__fsevents_event_cb()
235 state = loop->cf_state; in uv__fsevents_event_cb()
329 uv_loop_t* loop, in uv__fsevents_create_stream() argument
338 ctx.info = loop; in uv__fsevents_create_stream()
371 pFSEventStreamScheduleWithRunLoop(ref, state->loop, *pkCFRunLoopDefaultMode); in uv__fsevents_create_stream()
400 uv_loop_t* loop, in uv__fsevents_reschedule() argument
468 err = uv__fsevents_create_stream(state, loop, cf_paths); in uv__fsevents_reschedule()
580 static int uv__fsevents_loop_init(uv_loop_t* loop) { in uv__fsevents_loop_init() argument
586 if (loop->cf_state != NULL) in uv__fsevents_loop_init()
597 err = uv_mutex_init(&loop->cf_mutex); in uv__fsevents_loop_init()
601 err = uv_sem_init(&loop->cf_sem, 0); in uv__fsevents_loop_init()
605 uv__queue_init(&loop->cf_signals); in uv__fsevents_loop_init()
620 ctx.info = loop; in uv__fsevents_loop_init()
634 loop->cf_state = state; in uv__fsevents_loop_init()
637 err = UV__ERR(pthread_create(&loop->cf_thread, &attr, uv__cf_loop_runner, loop)); in uv__fsevents_loop_init()
646 uv_sem_wait(&loop->cf_sem); in uv__fsevents_loop_init()
650 loop->cf_state = NULL; in uv__fsevents_loop_init()
659 uv_sem_destroy(&loop->cf_sem); in uv__fsevents_loop_init()
662 uv_mutex_destroy(&loop->cf_mutex); in uv__fsevents_loop_init()
671 void uv__fsevents_loop_delete(uv_loop_t* loop) { in uv__fsevents_loop_delete() argument
676 if (loop->cf_state == NULL) in uv__fsevents_loop_delete()
679 if (uv__cf_loop_signal(loop, NULL, kUVCFLoopSignalRegular) != 0) in uv__fsevents_loop_delete()
682 uv_thread_join(&loop->cf_thread); in uv__fsevents_loop_delete()
683 uv_sem_destroy(&loop->cf_sem); in uv__fsevents_loop_delete()
684 uv_mutex_destroy(&loop->cf_mutex); in uv__fsevents_loop_delete()
687 while (!uv__queue_empty(&loop->cf_signals)) { in uv__fsevents_loop_delete()
688 q = uv__queue_head(&loop->cf_signals); in uv__fsevents_loop_delete()
695 state = loop->cf_state; in uv__fsevents_loop_delete()
700 loop->cf_state = NULL; in uv__fsevents_loop_delete()
706 uv_loop_t* loop; in uv__cf_loop_runner() local
709 loop = arg; in uv__cf_loop_runner()
710 state = loop->cf_state; in uv__cf_loop_runner()
711 state->loop = pCFRunLoopGetCurrent(); in uv__cf_loop_runner()
713 pCFRunLoopAddSource(state->loop, in uv__cf_loop_runner()
717 uv_sem_post(&loop->cf_sem); in uv__cf_loop_runner()
720 pCFRunLoopRemoveSource(state->loop, in uv__cf_loop_runner()
724 state->loop = NULL; in uv__cf_loop_runner()
732 uv_loop_t* loop; in uv__cf_loop_cb() local
738 loop = arg; in uv__cf_loop_cb()
739 state = loop->cf_state; in uv__cf_loop_cb()
741 uv_mutex_lock(&loop->cf_mutex); in uv__cf_loop_cb()
742 uv__queue_move(&loop->cf_signals, &split_head); in uv__cf_loop_cb()
743 uv_mutex_unlock(&loop->cf_mutex); in uv__cf_loop_cb()
753 pCFRunLoopStop(state->loop); in uv__cf_loop_cb()
755 uv__fsevents_reschedule(state, loop, s->type); in uv__cf_loop_cb()
763 int uv__cf_loop_signal(uv_loop_t* loop, in uv__cf_loop_signal() argument
776 uv_mutex_lock(&loop->cf_mutex); in uv__cf_loop_signal()
777 uv__queue_insert_tail(&loop->cf_signals, &item->member); in uv__cf_loop_signal()
779 state = loop->cf_state; in uv__cf_loop_signal()
782 pCFRunLoopWakeUp(state->loop); in uv__cf_loop_signal()
784 uv_mutex_unlock(&loop->cf_mutex); in uv__cf_loop_signal()
796 err = uv__fsevents_loop_init(handle->loop); in uv__fsevents_init()
825 uv_async_init(handle->loop, handle->cf_cb, uv__fsevents_cb); in uv__fsevents_init()
834 state = handle->loop->cf_state; in uv__fsevents_init()
843 err = uv__cf_loop_signal(handle->loop, handle, kUVCFLoopSignalRegular); in uv__fsevents_init()
874 state = handle->loop->cf_state; in uv__fsevents_close()
883 err = uv__cf_loop_signal(handle->loop, handle, kUVCFLoopSignalClosing); in uv__fsevents_close()