diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-12-06 12:16:02 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-12-06 12:16:02 +0300 |
commit | d14c0774c7e6f372dfebcfcafdcac718b7e28789 (patch) | |
tree | 6111a740fb2d1898b0375a8f65235d3f319b160a /src/go/unit/nxt_go_lib.h | |
parent | 0db4d2531648796a3447a409f05bd82bcc91ff9f (diff) | |
download | unit-d14c0774c7e6f372dfebcfcafdcac718b7e28789.tar.gz unit-d14c0774c7e6f372dfebcfcafdcac718b7e28789.tar.bz2 |
Go: removing request registry.
Passing unsafe.Pointers (void *) from Go to C is complicated by an attempt
to make such pointers less unsafe.
A straightforward optimization is to replace 'unsafe.Pointer' with 'uintptr'
(thanks to Xin Huang for the idea: https://stackoverflow.com/a/44826533 ).
As a result, request registry with mutex is gone.
Diffstat (limited to '')
-rw-r--r-- | src/go/unit/nxt_go_lib.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/go/unit/nxt_go_lib.h b/src/go/unit/nxt_go_lib.h index b3a86be9..33acf334 100644 --- a/src/go/unit/nxt_go_lib.h +++ b/src/go/unit/nxt_go_lib.h @@ -19,12 +19,12 @@ typedef struct { typedef uintptr_t nxt_go_request_t; -int nxt_go_response_write(nxt_go_request_t r, void *buf, size_t len); +int nxt_go_response_write(nxt_go_request_t r, uintptr_t buf, size_t len); -int nxt_go_request_read(nxt_go_request_t r, void *dst, size_t dst_len); +int nxt_go_request_read(nxt_go_request_t r, uintptr_t dst, size_t dst_len); -int nxt_go_request_read_from(nxt_go_request_t r, void *dst, size_t dst_len, - void *src, size_t src_len); +int nxt_go_request_read_from(nxt_go_request_t r, uintptr_t dst, size_t dst_len, + uintptr_t src, size_t src_len); int nxt_go_request_close(nxt_go_request_t r); @@ -32,8 +32,8 @@ int nxt_go_request_done(nxt_go_request_t r); void nxt_go_ready(); -nxt_go_request_t nxt_go_process_port_msg(void *buf, size_t buf_len, - void *oob, size_t oob_len); +nxt_go_request_t nxt_go_process_port_msg(uintptr_t buf, size_t buf_len, + uintptr_t oob, size_t oob_len); #endif /* _NXT_GO_LIB_H_INCLUDED_ */ |