diff options
author | Simon Rettberg | 2019-08-07 17:11:51 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-07 17:11:51 +0200 |
commit | be7d7d95850c30a154aaa56e95d6a7f36793409d (patch) | |
tree | 53bcae440652076d53cb01bfb7ee73fc2d868283 /src/server/uplink.c | |
parent | [SERVER] Lock-free queue for altservers check thread (diff) | |
download | dnbd3-be7d7d95850c30a154aaa56e95d6a7f36793409d.tar.gz dnbd3-be7d7d95850c30a154aaa56e95d6a7f36793409d.tar.xz dnbd3-be7d7d95850c30a154aaa56e95d6a7f36793409d.zip |
[SERVER] Better lock debugging: Always check lock order
Lock order is predefined in locks.h. Immediately bail out if a lock with
lower priority is obtained while the same thread already holds one with
higher priority.
Diffstat (limited to 'src/server/uplink.c')
-rw-r--r-- | src/server/uplink.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server/uplink.c b/src/server/uplink.c index bb1ffdc..9570273 100644 --- a/src/server/uplink.c +++ b/src/server/uplink.c @@ -89,9 +89,9 @@ bool uplink_init(dnbd3_image_t *image, int sock, dnbd3_host_t *host, int version goto failure; } link = image->uplink = calloc( 1, sizeof(dnbd3_connection_t) ); - mutex_init( &link->queueLock ); - mutex_init( &link->rttLock ); - mutex_init( &link->sendMutex ); + mutex_init( &link->queueLock, LOCK_UPLINK_QUEUE ); + mutex_init( &link->rttLock, LOCK_UPLINK_RTT ); + mutex_init( &link->sendMutex, LOCK_UPLINK_SEND ); link->image = image; link->bytesReceived = 0; link->idleTime = 0; |