Lines Matching refs:state

229   uv__cf_loop_state_t* state;
235 state = loop->cf_state;
236 assert(state != NULL);
240 uv_mutex_lock(&state->fsevent_mutex);
241 uv__queue_foreach(q, &state->fsevent_handles) {
327 uv_mutex_unlock(&state->fsevent_mutex);
332 static int uv__fsevents_create_stream(uv__cf_loop_state_t* state,
375 pFSEventStreamScheduleWithRunLoop(ref, state->loop, *pkCFRunLoopDefaultMode);
382 state->fsevent_stream = ref;
388 static void uv__fsevents_destroy_stream(uv__cf_loop_state_t* state) {
389 if (state->fsevent_stream == NULL)
393 pFSEventStreamStop(state->fsevent_stream);
396 pFSEventStreamInvalidate(state->fsevent_stream);
397 pFSEventStreamRelease(state->fsevent_stream);
398 state->fsevent_stream = NULL;
403 static void uv__fsevents_reschedule(uv__cf_loop_state_t* state,
423 uv_mutex_lock(&state->fsevent_mutex);
424 if (state->fsevent_need_reschedule == 0) {
425 uv_mutex_unlock(&state->fsevent_mutex);
428 state->fsevent_need_reschedule = 0;
429 uv_mutex_unlock(&state->fsevent_mutex);
432 uv__fsevents_destroy_stream(state);
438 uv_mutex_lock(&state->fsevent_mutex);
439 path_count = state->fsevent_handle_count;
443 uv_mutex_unlock(&state->fsevent_mutex);
447 q = &state->fsevent_handles;
450 assert(q != &state->fsevent_handles);
457 uv_mutex_unlock(&state->fsevent_mutex);
462 uv_mutex_unlock(&state->fsevent_mutex);
472 err = uv__fsevents_create_stream(state, loop, cf_paths);
488 uv_mutex_lock(&state->fsevent_mutex);
489 uv__queue_foreach(q, &state->fsevent_handles) {
493 uv_mutex_unlock(&state->fsevent_mutex);
503 uv_sem_post(&state->fsevent_sem);
586 uv__cf_loop_state_t* state;
597 state = uv__calloc(1, sizeof(*state));
598 if (state == NULL)
611 err = uv_sem_init(&state->fsevent_sem, 0);
615 err = uv_mutex_init(&state->fsevent_mutex);
619 uv__queue_init(&state->fsevent_handles);
620 state->fsevent_need_reschedule = 0;
621 state->fsevent_handle_count = 0;
626 state->signal_source = pCFRunLoopSourceCreate(NULL, 0, &ctx);
627 if (state->signal_source == NULL) {
638 loop->cf_state = state;
657 uv_mutex_destroy(&state->fsevent_mutex);
660 uv_sem_destroy(&state->fsevent_sem);
669 uv__free(state);
677 uv__cf_loop_state_t* state;
698 /* Destroy state */
699 state = loop->cf_state;
700 uv_sem_destroy(&state->fsevent_sem);
701 uv_mutex_destroy(&state->fsevent_mutex);
702 pCFRelease(state->signal_source);
703 uv__free(state);
711 uv__cf_loop_state_t* state;
714 state = loop->cf_state;
715 state->loop = pCFRunLoopGetCurrent();
717 pCFRunLoopAddSource(state->loop,
718 state->signal_source,
724 pCFRunLoopRemoveSource(state->loop,
725 state->signal_source,
728 state->loop = NULL;
737 uv__cf_loop_state_t* state;
743 state = loop->cf_state;
757 pCFRunLoopStop(state->loop);
759 uv__fsevents_reschedule(state, loop, s->type);
771 uv__cf_loop_state_t* state;
783 state = loop->cf_state;
784 assert(state != NULL);
785 pCFRunLoopSourceSignal(state->signal_source);
786 pCFRunLoopWakeUp(state->loop);
797 uv__cf_loop_state_t* state;
833 state = handle->loop->cf_state;
834 uv_mutex_lock(&state->fsevent_mutex);
835 uv__queue_insert_tail(&state->fsevent_handles, &handle->cf_member);
836 state->fsevent_handle_count++;
837 state->fsevent_need_reschedule = 1;
838 uv_mutex_unlock(&state->fsevent_mutex);
867 uv__cf_loop_state_t* state;
873 state = handle->loop->cf_state;
874 uv_mutex_lock(&state->fsevent_mutex);
876 state->fsevent_handle_count--;
877 state->fsevent_need_reschedule = 1;
878 uv_mutex_unlock(&state->fsevent_mutex);
887 uv_sem_wait(&state->fsevent_sem);