Compare commits

...

1 Commits

Author SHA1 Message Date
Artem Boldariev
badbea3a8f Make worker->shuttingdown atomic
This record member could be accessed concurrently from within the
context of multiple threads. For example, it is used in
isc__nmsocket_closing(), which can be called on listener sockets from
a context of a thread which does not own the object.

This lead to TSAN reports, this commit should fix that.
2022-11-28 18:33:58 +02:00
2 changed files with 3 additions and 3 deletions

View File

@@ -202,7 +202,7 @@ typedef struct isc__networker {
isc_refcount_t references;
isc_loop_t *loop;
isc_nm_t *netmgr;
bool shuttingdown;
atomic_bool shuttingdown;
char *recvbuf;
char *sendbuf;

View File

@@ -156,7 +156,7 @@ networker_teardown(void *arg) {
isc__networker_t *worker = arg;
isc_loop_t *loop = worker->loop;
worker->shuttingdown = true;
atomic_store(&worker->shuttingdown, true);
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, ISC_LOGMODULE_NETMGR,
ISC_LOG_DEBUG(1),
@@ -1705,7 +1705,7 @@ isc__nm_stop_reading(isc_nmsocket_t *sock) {
bool
isc__nm_closing(isc__networker_t *worker) {
return (worker->shuttingdown);
return (atomic_load(&worker->shuttingdown));
}
bool