diff options
author | Simon Rettberg | 2019-07-26 17:22:56 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-07-26 17:22:56 +0200 |
commit | b071050dd6a99c54c5995dc0f5694edd847a2792 (patch) | |
tree | 4899a2a88b3005ef69cd0a81fcbe35f7019ddb56 /src/server/globals.h | |
parent | [SERVER] Add pretendClient config option (diff) | |
download | dnbd3-b071050dd6a99c54c5995dc0f5694edd847a2792.tar.gz dnbd3-b071050dd6a99c54c5995dc0f5694edd847a2792.tar.xz dnbd3-b071050dd6a99c54c5995dc0f5694edd847a2792.zip |
[SERVER] Turn all spinlocks into mutexes
Just assume sane platforms offer smart mutexes
that have a fast-path with spinlocks internally
for locks that have little to no congestion.
In all other cases, mutexes should perform better
anyways.
Diffstat (limited to 'src/server/globals.h')
-rw-r--r-- | src/server/globals.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/globals.h b/src/server/globals.h index 031f565..b248800 100644 --- a/src/server/globals.h +++ b/src/server/globals.h @@ -54,10 +54,10 @@ struct _dnbd3_connection dnbd3_signal_t* signal; // used to wake up the process pthread_t thread; // thread holding the connection pthread_mutex_t sendMutex; // For locking socket while sending - pthread_spinlock_t queueLock; // lock for synchronization on request queue etc. + pthread_mutex_t queueLock; // lock for synchronization on request queue etc. dnbd3_image_t *image; // image that this uplink is used for; do not call get/release for this pointer dnbd3_host_t currentServer; // Current server we're connected to - pthread_spinlock_t rttLock; // When accessing rttTestResult, betterFd or betterServer + pthread_mutex_t rttLock; // When accessing rttTestResult, betterFd or betterServer int rttTestResult; // RTT_* int cacheFd; // used to write to the image, in case it is relayed. ONLY USE FROM UPLINK THREAD! int betterVersion; // protocol version of better server @@ -121,7 +121,7 @@ struct _dnbd3_image int id; // Unique ID of this image. Only unique in the context of this running instance of DNBD3-Server bool working; // true if image exists and completeness is == 100% or a working upstream proxy is connected uint16_t rid; // revision of image - pthread_spinlock_t lock; + pthread_mutex_t lock; }; struct _dnbd3_client @@ -134,7 +134,7 @@ struct _dnbd3_client dnbd3_host_t host; char hostName[HOSTNAMELEN]; // inet_ntop version of host pthread_mutex_t sendMutex; // Held while writing to sock if image is incomplete (since uplink uses socket too) - pthread_spinlock_t lock; + pthread_mutex_t lock; }; // ####################################################### |