]> git.puffer.fish Git - mirror/frr.git/commit
lib: streamline frr_pthreads, add default loop
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 22 Jan 2018 19:23:55 +0000 (14:23 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 24 Jan 2018 20:30:50 +0000 (15:30 -0500)
commita45dc9742c3e4e504f66bf18b7bc9da3c218233a
tree091042b0cbc6b0c7c46f2dfe6eda1ba5093f9dca
parent872c4e980e45e7185530b76e9e8541fa2b6c9375
lib: streamline frr_pthreads, add default loop

Some work on FRR's pthread wrapper.

* Provide a built-in way to synchronize thread startup
* Make utility functions take frr_pthread * instead of its integer ID
* Pass frr_pthread * as pthread start function argument
* Correct some comment styling
* Rename some variables to match naming conventions in the file
* Change parameter ordering in stop function prototype to follow the
  convention in the other functions
* Default new frr_pthreads to using a vanilla event loop

For the last point, the original goal when designing the implementation
of pthreads into FRR was to be able to use the thread.c event based
system inside pthreads. This code essentially encapuslates all the
thread.c functionality into an easy to use pthread out of the box.
Creating a new frr_pthread with a null attributes field will cause the
created frr_pthread to run a thread.c event loop. The upshot of this is
that it is now possible to safely run existing functions in a pthread in
roughly 3 lines of code. It also serves as an example / starting point
for others.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/frr_pthread.c
lib/frr_pthread.h