]> git.puffer.fish Git - matthieu/frr.git/commit
lib: add pthread manager
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 16 Apr 2017 03:14:36 +0000 (03:14 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 28 Apr 2017 22:43:42 +0000 (22:43 +0000)
commit98f14af8bf8340115049e0df4888b6acc8701ea5
treeb12f797be46311913a96d93f03b23b5a99320926
parent2c70efaed19379be49457069fc033d322394e29d
lib: add pthread manager

Adds infrastructure for keeping track of pthreads.

The general idea is to maintain a daemon-wide table of all pthreads,
running or not. A pthread is associated with its own thread master that
can be used with existing thread.c code, which provides user-space
timers, an event loop, non-blocking I/O callbacks and other facilities.

Each frr_pthread has a unique identifier that can be used to fetch it
from the table. This is to allow naming threads using a macro, for
example:

 #define WRITE_THREAD 0
 #define READ_THREAD  1
 #define WORK_THREAD  2

The idea here is to be relatively flexible with regard to how daemons
manage their collection of pthreads; the implementation could get away
with just some #define'd constants, or keep a dynamically allocated data
structure that provides organization, searching, prioritizing, etc.

Overall this interface should provide a way to maintain the familiar
thread.c userspace threading model while progressively introducing
pthreads.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/Makefile.am
lib/frr_pthread.c [new file with mode: 0644]
lib/frr_pthread.h [new file with mode: 0644]