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

Commit cd2794c

Browse files
committed
fsevents: use shared FSEventStream
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
1 parent abcad99 commit cd2794c

File tree

4 files changed

+345
-158
lines changed

4 files changed

+345
-158
lines changed

include/uv-darwin.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636

3737
#define UV_PLATFORM_LOOP_FIELDS \
3838
uv_thread_t cf_thread; \
39-
void* cf_cb; \
40-
void* cf_loop; \
39+
void* _cf_reserved; \
40+
void* cf_state; \
4141
uv_mutex_t cf_mutex; \
4242
uv_sem_t cf_sem; \
4343
void* cf_signals[2]; \
@@ -47,10 +47,10 @@
4747
char* realpath; \
4848
int realpath_len; \
4949
int cf_flags; \
50-
void* cf_eventstream; \
50+
void* cf_event; \
5151
uv_async_t* cf_cb; \
52-
void* cf_events[2]; \
53-
uv_sem_t cf_sem; \
52+
void* cf_member[2]; \
53+
uv_sem_t _cf_reserved; \
5454
uv_mutex_t cf_mutex; \
5555

5656
#define UV_STREAM_PRIVATE_PLATFORM_FIELDS \

src/unix/darwin.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939

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

4343
if (uv__kqueue_init(loop))
4444
return -errno;

0 commit comments

Comments
 (0)