diff options
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/locks/locks.c | 2 | ||||
-rw-r--r-- | libnetdata/locks/locks.h | 4 | ||||
-rw-r--r-- | libnetdata/worker_utilization/worker_utilization.c | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/libnetdata/locks/locks.c b/libnetdata/locks/locks.c index 0a9198119b..e73456d706 100644 --- a/libnetdata/locks/locks.c +++ b/libnetdata/locks/locks.c @@ -279,7 +279,7 @@ int __netdata_rwlock_trywrlock(netdata_rwlock_t *rwlock) { // https://www.youtube.com/watch?v=rmGJc9PXpuE&t=41s void netdata_spinlock_init(SPINLOCK *spinlock) { - *spinlock = NETDATA_SPINLOCK_INITIALIZER; + memset(spinlock, 0, sizeof(SPINLOCK)); } void netdata_spinlock_lock(SPINLOCK *spinlock) { diff --git a/libnetdata/locks/locks.h b/libnetdata/locks/locks.h index a04cfdc0f9..34cdb13e7e 100644 --- a/libnetdata/locks/locks.h +++ b/libnetdata/locks/locks.h @@ -16,7 +16,9 @@ typedef struct netdata_spinlock { pid_t locker_pid; #endif } SPINLOCK; -#define NETDATA_SPINLOCK_INITIALIZER (SPINLOCK) { .locked = false } + +#define NETDATA_SPINLOCK_INITIALIZER \ + { .locked = false } void netdata_spinlock_init(SPINLOCK *spinlock); void netdata_spinlock_lock(SPINLOCK *spinlock); diff --git a/libnetdata/worker_utilization/worker_utilization.c b/libnetdata/worker_utilization/worker_utilization.c index afaff209b5..b0dcf034dd 100644 --- a/libnetdata/worker_utilization/worker_utilization.c +++ b/libnetdata/worker_utilization/worker_utilization.c @@ -83,7 +83,7 @@ void worker_register(const char *name) { struct workers_workname *workname = *PValue; if(!workname) { workname = mallocz(sizeof(struct workers_workname)); - workname->spinlock = NETDATA_SPINLOCK_INITIALIZER; + netdata_spinlock_init(&workname->spinlock); workname->base = NULL; *PValue = workname; } |