GNUnet Worker 1.0.0

As it is often the case with network applications, GNUnet is built following a single-threaded event-driven model. This is an optimal model when dealing with high concurrency scenarios, but can be problematic in other contexts (like, for example, graphical user interfaces, which normally have their own event loop). To accomplish its event-driven flow, GNUnet uses a scheduler. Once such scheduler is started, it is not designed to be invoked by other threads, but can schedule only routines requested by its own thread. What to do then if an application needs to deal with multiple threads and let the latter interface with GNUnet's scheduler? This framework offers a simple solution by creating a “bearing” between the threads and the scheduler. The latter is run in its own dedicated thread and is unaware of the existence of other threads. Such a bearing consists in a “wish list” of routines to schedule, which can be populated asynchronously by any thread and gets emptied synchronously only by the scheduler according to the latter's natural flow.

Tags c event-loop gnunet gnu library multithreading shared-library threads unix
License Affero GPLv3
State stable

Recent Releases

1.0.014 Jul 2022 01:15 major feature: (2022-07-13). Changes: Version 0.5.0 can now be considered stable; the version string has been updated to 1.0.0. The public header has been moved back into the `src` subdirectory.
0.5.013 Feb 2022 23:37 major feature: (2022-02-13). Changes: The semantics of the `on_worker_start` routine has changed, and the function can now return more precise instructions about what must be done, after it returns, with its worker. Please be aware that this breaks binary compatibility with previous versions of this library. The opaque `struct` that contains a worker has been renamed to. `GNUNET_WORKER_Instance`, while its former `GNUNET_WORKER_Handle` identifier is now being used for a pointer to it (source compatibility break). Documentation. Examples.
0.4.107 Feb 2022 03:15 minor feature: (2022-02-07). Changes: Minor code review. Documentation. Examples.
0.4.004 Feb 2022 03:15 major feature: (2022-02-01). Changes: Identifier `GNUNET_WORKER_ERR_OK` in `enum GNUNET_WORKER_ErrNo` has been renamed to `GNUNET_WORKER_SUCCESS`. The behavior of all functions has been rendered as agnostic as possible in respect to which thread invokes them. Conditional branching has been made more coherent, although this has come with a cost in the length and the complexity of the code. General code review. Documentation.
0.3.131 Jan 2022 16:46 minor bugfix: (2022-01-29). Changes: Code review in the implementation (a possible memory leak before worker. Destruction has been prevented; the `O_NONBLOCK` flag has been assigned to The worker's file descriptor; unnecessary calls to `pthread_cond_signal()` Have been removed from `requirement.h`; general code review) Documentation.
0.3.029 Jan 2022 02:53 major feature: The interface has changed in respect to worker creation. All the three functions `GNUNET_WORKER_create()`, `GNUNET_WORKER_start_serving()`. `GNUNET_WORKER_adopt_running_scheduler()` now return error codes, while the handle for the allocated worker is passed via placeholder argument. This breaks binary compatibility with previous versions. Using error codes has allowed to remove several log messages, which now will be up to the user. Support for a `master_routine` argument has been added to. `GNUNET_WORKER_adopt_running_scheduler()` (again, binary compatibility break). The `GNUNET_WorkerHandlerRoutine` data type has been renamed to. `GNUNET_WORKER_MasterRoutine`. A new `GNUNET_WORKER_ERR_NOT_ALONE` error code can now be returned by. `GNUNET_WORKER_synch_destroy()` and `GNUNET_WORKER_timedsynch_destroy()`. The role of the `on_worker_end` routine has been defined more strictly. General code review in the implementation. Documentation. Examples.
0.2.027 Jan 2022 12:32 minor feature: Identifier `GNUNET_WORKER_ERR_NOTIFICATION` in `enum GNUNET_WORKER_ErrNo` has been renamed to `GNUNET_WORKER_ERR_SIGNAL`. A missing check has been added to `GNUNET_WORKER_adopt_running_scheduler()`. Owned threads have been ensured to result in either joined or detached after calling `GNUNET_WORKER_asynch_destroy()`, `GNUNET_WORKER_synch_destroy()`. `GNUNET_WORKER_timedsynch_destroy()` or `GNUNET_WORKER_dismiss()`. `GNUNET_WORKER_ERR_SIGNAL` has been added to the possible return values of `GNUNET_WORKER_start_serving()`. Stack usage during worker creation has been drastically reduced. Log messages and source code have been made more expressive. The `Requirement` data type and its methods have been moved to a separate private header (`src/requirement.h`). The public header has been moved to the `include` subdirectory. General package review. Documentation. Examples.
0.1.025 Jan 2022 05:17 major feature: **GNUnet Worker** has been published.