Adding a reference counter to the libunit port structure.
The goal is to minimize the number of (pid, id) to port hash lookups which require a library mutex lock. The response port is found once per request, while the read port is initialized at startup.
This commit is contained in:
@@ -15,9 +15,9 @@ static nxt_cgo_str_t *nxt_cgo_str_init(nxt_cgo_str_t *dst,
|
||||
nxt_unit_sptr_t *sptr, uint32_t length);
|
||||
static int nxt_cgo_add_port(nxt_unit_ctx_t *, nxt_unit_port_t *port);
|
||||
static void nxt_cgo_remove_port(nxt_unit_t *, nxt_unit_port_t *port);
|
||||
static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id,
|
||||
static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *, nxt_unit_port_t *port,
|
||||
const void *buf, size_t buf_size, const void *oob, size_t oob_size);
|
||||
static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id,
|
||||
static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *, nxt_unit_port_t *port,
|
||||
void *buf, size_t buf_size, void *oob, size_t oob_size);
|
||||
static void nxt_cgo_shm_ack_handler(nxt_unit_ctx_t *ctx);
|
||||
|
||||
@@ -123,19 +123,19 @@ nxt_cgo_remove_port(nxt_unit_t *unit, nxt_unit_port_t *port)
|
||||
|
||||
|
||||
static ssize_t
|
||||
nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id,
|
||||
nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
|
||||
const void *buf, size_t buf_size, const void *oob, size_t oob_size)
|
||||
{
|
||||
return nxt_go_port_send(port_id->pid, port_id->id,
|
||||
return nxt_go_port_send(port->id.pid, port->id.id,
|
||||
(void *) buf, buf_size, (void *) oob, oob_size);
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id,
|
||||
nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
|
||||
void *buf, size_t buf_size, void *oob, size_t oob_size)
|
||||
{
|
||||
return nxt_go_port_recv(port_id->pid, port_id->id,
|
||||
return nxt_go_port_recv(port->id.pid, port->id.id,
|
||||
buf, buf_size, oob, oob_size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user