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

Commit

Permalink
fsevents: use shared FSEventStream
Browse files Browse the repository at this point in the history
It seems that number of simultaneously opened FSEventStreams is
limited on OSX (i.e. you can have only fixed number of them on
one running system), getting past through this limit will cause
`FSEventStreamCreate` to return false and write following message
to stderr:

    (CarbonCore.framework) FSEventStreamStart: register_with_server:
    ERROR: f2d_register_rpc() => (null) (-21)

To prevent this, we must use only one shared FSEventStream with a
paths for all uv_fsevent_t handles, and then filter out events for
each handle using this paths again.

See nodejs/node-v0.x-archive#5463

Conflicts:
	include/uv-private/uv-darwin.h
	src/unix/fsevents.c
  • Loading branch information
indutny committed Aug 22, 2013
1 parent ea4cb77 commit 684e212
Show file tree
Hide file tree
Showing 4 changed files with 369 additions and 161 deletions.
10 changes: 5 additions & 5 deletions include/uv-private/uv-darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

#define UV_PLATFORM_LOOP_FIELDS \
uv_thread_t cf_thread; \
void* cf_cb; \
void* cf_loop; \
void* _cf_reserved; \
void* cf_state; \
uv_mutex_t cf_mutex; \
uv_sem_t cf_sem; \
ngx_queue_t cf_signals; \
Expand All @@ -47,10 +47,10 @@
char* realpath; \
int realpath_len; \
int cf_flags; \
void* cf_eventstream; \
void* cf_event; \
uv_async_t* cf_cb; \
ngx_queue_t cf_events; \
uv_sem_t cf_sem; \
ngx_queue_t cf_member; \
uv_sem_t _cf_reserved; \
uv_mutex_t cf_mutex; \

#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \
Expand Down
2 changes: 1 addition & 1 deletion src/unix/darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@


int uv__platform_loop_init(uv_loop_t* loop, int default_loop) {
loop->cf_loop = NULL;
loop->cf_state = NULL;

if (uv__kqueue_init(loop))
return -1;
Expand Down
Loading

0 comments on commit 684e212

Please sign in to comment.