Skip to content

Commit f33b76d

Browse files
committed
Refactor RPC command mutex handling to use socket-specific mutex
1 parent e1e8e91 commit f33b76d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ggml/src/ggml-rpc/ggml-rpc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct socket_t {
5151
close(this->fd);
5252
#endif
5353
}
54+
std::mutex send_rpc_cmd_mutex;
5455
};
5556

5657
// all RPC structures must be packed
@@ -386,8 +387,7 @@ static bool parse_endpoint(const std::string & endpoint, std::string & host, int
386387
// RPC request : | rpc_cmd (1 byte) | request_size (8 bytes) | request_data (request_size bytes) |
387388
// No response
388389
static bool send_rpc_cmd(const std::shared_ptr<socket_t> & sock, enum rpc_cmd cmd, const void * input, size_t input_size) {
389-
static std::mutex send_rpc_cmd_mutex;
390-
std::lock_guard<std::mutex> lock(send_rpc_cmd_mutex);
390+
std::lock_guard<std::mutex> lock(sock->send_rpc_cmd_mutex);
391391
uint8_t cmd_byte = cmd;
392392
if (!send_data(sock->fd, &cmd_byte, sizeof(cmd_byte))) {
393393
return false;

0 commit comments

Comments
 (0)