diff options
author | Nicolas Dato <nicolas.dato@gmail.com> | 2025-07-02 23:41:29 -0300 |
---|---|---|
committer | Nicolas Dato <nicolas.dato@gmail.com> | 2025-07-02 23:41:29 -0300 |
commit | 4c15b4e3459311f8d458e0e9c031a473efe5f0b8 (patch) | |
tree | bad582b89b713a68b48eb7fc9a01c03adcdf7fe7 /src/itc.c | |
parent | 2ce4fb4a3cfb0d1cb92e9cbd71087fa16414631e (diff) | |
download | libtuberia-4c15b4e3459311f8d458e0e9c031a473efe5f0b8.tar.gz |
adding an example, without using libtuberia for now
Diffstat (limited to 'src/itc.c')
-rw-r--r-- | src/itc.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -24,7 +24,7 @@ itc *itc_alloc(int nslots) ctx = calloc(1, sizeof(*ctx)); ctx->nslots = nslots; - ctx->slots = calloc(nslots, sizeof(*ctx->slots)); + ctx->slots = (void **)calloc(nslots, sizeof(*ctx->slots)); sem_init(&ctx->emptied, 0, nslots); sem_init(&ctx->occupied, 0, 0); @@ -41,7 +41,7 @@ void itc_free(itc **ctx, itc_free_element free_element) sem_destroy(&(*ctx)->emptied); sem_destroy(&(*ctx)->occupied); - free((*ctx)->slots); + free((void *)(*ctx)->slots); free(*ctx); *ctx = NULL; } @@ -55,7 +55,7 @@ void *itc_retrive(itc *ctx, int timeout_ms) return NULL; } - timespec_add_ms(gettimespec(&ts), timeout_ms); + timespec_add_ms(get_timespec(&ts), timeout_ms); if (sem_timedwait(&ctx->occupied, &ts)) { return NULL; @@ -75,7 +75,7 @@ int itc_inject(itc *ctx, int timeout_ms, void *element) return -1; } - timespec_add_ms(gettimespec(&ts), timeout_ms); + timespec_add_ms(get_timespec(&ts), timeout_ms); if (sem_timedwait(&ctx->emptied, &ts)) { return -1; |