diff options
author | Simon Rettberg | 2019-08-07 14:39:44 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-07 14:39:44 +0200 |
commit | 4e2e258dba3c9268e8d4fd061cbb9f291017ed2f (patch) | |
tree | 4f5e07a350a47802ef012bd0ef6af32a7e700c96 /src/server/globals.h | |
parent | [SERVER] Fix race condition and invalid lock order (diff) | |
download | dnbd3-4e2e258dba3c9268e8d4fd061cbb9f291017ed2f.tar.gz dnbd3-4e2e258dba3c9268e8d4fd061cbb9f291017ed2f.tar.xz dnbd3-4e2e258dba3c9268e8d4fd061cbb9f291017ed2f.zip |
[SERVER] Use more _Atomic
Diffstat (limited to 'src/server/globals.h')
-rw-r--r-- | src/server/globals.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server/globals.h b/src/server/globals.h index cd5ad7e..86b8865 100644 --- a/src/server/globals.h +++ b/src/server/globals.h @@ -60,7 +60,7 @@ struct _dnbd3_connection // If BGR == BGR_HASHBLOCK, -1 means "currently no incomplete block" uint64_t replicationHandle; // Handle of pending replication request atomic_uint_fast64_t bytesReceived; // Number of bytes received by the uplink since startup. - int queueLen; // length of queue + atomic_int queueLen; // length of queue uint32_t idleTime; // How many seconds the uplink was idle (apart from keep-alives) dnbd3_queued_request_t queue[SERVER_MAX_UPLINK_QUEUE]; }; @@ -107,7 +107,7 @@ struct _dnbd3_image int completenessEstimate; // Completeness estimate in percent atomic_int users; // clients currently using this image. XXX Lock on imageListLock when modifying and checking whether the image should be freed. Reading it elsewhere is fine without the lock. 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 + atomic_bool working; // true if image exists and completeness is == 100% or a working upstream proxy is connected uint16_t rid; // revision of image pthread_mutex_t lock; }; @@ -116,7 +116,7 @@ struct _dnbd3_client { #define HOSTNAMELEN (48) atomic_uint_fast64_t bytesSent; // Byte counter for this client. - dnbd3_image_t *image; // Image in use by this client, or NULL during handshake + dnbd3_image_t * _Atomic image; // Image in use by this client, or NULL during handshake int sock; bool isServer; // true if a server in proxy mode, false if real client dnbd3_host_t host; |