diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2023-03-22 12:57:13 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2023-03-24 10:04:53 +0100 |
commit | 2a0cd15420427fcf0501c8bc1faf5cfee7734657 (patch) | |
tree | 0f88d3976f41a8d47cdc7beec2e4ccb984a627c6 /src/ipcpd/udp | |
parent | 54156a3d9a2a7f87591e5efd37a8fe6f708b933f (diff) | |
download | ouroboros-2a0cd15420427fcf0501c8bc1faf5cfee7734657.tar.gz ouroboros-2a0cd15420427fcf0501c8bc1faf5cfee7734657.zip |
ipcpd: Fix condvar initialization in ipcpd-udp
The clock was not explicitly initialized in the ipcpd-udp.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/udp')
-rw-r--r-- | src/ipcpd/udp/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c index c47f6484..1a573696 100644 --- a/src/ipcpd/udp/main.c +++ b/src/ipcpd/udp/main.c @@ -140,12 +140,18 @@ struct { static int udp_data_init(void) { - int i; + int i; + pthread_condattr_t cattr; if (pthread_rwlock_init(&udp_data.flows_lock, NULL)) goto fail_rwlock_init; - if (pthread_cond_init(&udp_data.mgmt_cond, NULL)) + if (pthread_condattr_init(&cattr)) + goto fail_condattr; +#ifndef __APPLE__ + pthread_condattr_setclock(&cattr, PTHREAD_COND_CLOCK); +#endif + if (pthread_cond_init(&udp_data.mgmt_cond, &cattr)) goto fail_mgmt_cond; if (pthread_mutex_init(&udp_data.mgmt_lock, NULL)) @@ -162,9 +168,12 @@ static int udp_data_init(void) if (udp_data.shim_data == NULL) goto fail_data; + pthread_condattr_destroy(&cattr); + list_head_init(&udp_data.mgmt_frames); return 0; + fail_data: fset_destroy(udp_data.np1_flows); fail_fset: @@ -172,6 +181,8 @@ static int udp_data_init(void) fail_mgmt_lock: pthread_cond_destroy(&udp_data.mgmt_cond); fail_mgmt_cond: + pthread_condattr_destroy(&cattr); + fail_condattr: pthread_rwlock_destroy(&udp_data.flows_lock); fail_rwlock_init: return -1; |