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
  • Loading branch information
indutny committed Aug 22, 2013
1 parent abcad99 commit cd2794c
Show file tree
Hide file tree
Showing 4 changed files with 345 additions and 158 deletions.
10 changes: 5 additions & 5 deletions include/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; \
void* cf_signals[2]; \
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; \
void* cf_events[2]; \
uv_sem_t cf_sem; \
void* cf_member[2]; \
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 @@ -38,7 +38,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 -errno;
Expand Down
Loading

0 comments on commit cd2794c

Please sign in to comment.