![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
wait_for_threaded_pool must return when a proc that was STILL RUNNING at the moment of the call finishes. More...
#include "nilorea/n_common.h"#include "nilorea/n_log.h"#include "nilorea/n_thread_pool.h"#include <stdio.h>#include <unistd.h>Go to the source code of this file.
Functions | |
| int | main (void) |
| static void * | slow_proc (void *p) |
wait_for_threaded_pool must return when a proc that was STILL RUNNING at the moment of the call finishes.
That ordering is the one that used to strand the caller: the idle token is posted by refresh_thread_pool only, and the post was guarded by reading sem_getvalue, whose result POSIX leaves unspecified while a thread is blocked in sem_wait. Where that read is not zero for a blocked waiter (winpthreads reports a negative waiter count) the post was skipped and the waiter never woke. glibc reports zero, so this passes on Linux either way; it is a guard against reintroducing the dependency, and it fails outright anywhere the value differs.
Definition in file ex_thread_pool_wait.c.
| int main | ( | void | ) |
Definition at line 42 of file ex_thread_pool_wait.c.
References add_threaded_process(), destroy_threaded_pool(), LOG_ERR, new_thread_pool(), NORMAL_PROC, pool, set_log_level(), slow_proc(), and wait_for_threaded_pool().
|
static |
Definition at line 36 of file ex_thread_pool_wait.c.
Referenced by main().