|
27 | 27 | _handle; \
|
28 | 28 | })
|
29 | 29 |
|
30 |
| -#define NIF_ENTRY(FUNCTION_NAME, ARITY) \ |
31 |
| - { \ |
32 |
| - #FUNCTION_NAME, ARITY, FUNCTION_NAME \ |
| 30 | +#define NIF_ENTRY(FUNCTION_NAME, ARITY, ...) \ |
| 31 | + { \ |
| 32 | + #FUNCTION_NAME, ARITY, FUNCTION_NAME, __VA_ARGS__ \ |
33 | 33 | }
|
34 | 34 |
|
35 | 35 | const uint64_t BUFFER_SIZE = 4096;
|
@@ -276,13 +276,14 @@ static ErlNifFunc nif_funcs[] = {
|
276 | 276 | NIF_ENTRY(host_new, 1),
|
277 | 277 | NIF_ENTRY(host_close, 1),
|
278 | 278 | NIF_ENTRY(host_set_stream_handler, 2),
|
279 |
| - NIF_ENTRY(host_new_stream, 3), |
| 279 | + // TODO: check if host_new_stream is truly dirty |
| 280 | + NIF_ENTRY(host_new_stream, 3, ERL_NIF_DIRTY_JOB_IO_BOUND), // blocks negotiating protocol |
280 | 281 | NIF_ENTRY(host_peerstore, 1),
|
281 | 282 | NIF_ENTRY(host_id, 1),
|
282 | 283 | NIF_ENTRY(host_addrs, 1),
|
283 | 284 | NIF_ENTRY(peerstore_add_addrs, 4),
|
284 |
| - NIF_ENTRY(stream_read, 1), |
285 |
| - NIF_ENTRY(stream_write, 2), |
| 285 | + NIF_ENTRY(stream_read, 1, ERL_NIF_DIRTY_JOB_IO_BOUND), // blocks until reading |
| 286 | + NIF_ENTRY(stream_write, 2, ERL_NIF_DIRTY_JOB_IO_BOUND), // blocks when buffer is full |
286 | 287 | NIF_ENTRY(stream_close, 1),
|
287 | 288 | };
|
288 | 289 |
|
|
0 commit comments