diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-03-03 19:01:49 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-04-28 22:43:36 +0000 |
| commit | 1189d95fcab50132623cb8f8c25f78ed68ec36e2 (patch) | |
| tree | 9296aafc071ed7e116d1a1cdbba6dec1f0e0cf4d /lib/thread.h | |
| parent | ed8ba2e92048e4164fa91e70aa3ed5e31f85bba1 (diff) | |
lib: make thread.c pthread-safe
This change introduces synchronization mechanisms to thread.c in order
to allow safe concurrent use.
Thread.c should now be threadstafe with respect to:
* struct thread
* struct thread_master
Calls into thread.c for operations upon data of this type should not
require external synchronization.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/thread.h')
| -rw-r--r-- | lib/thread.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/thread.h b/lib/thread.h index 34adcc4d09..0cc9841272 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -24,6 +24,7 @@ #include <zebra.h> #include "monotime.h" +#include <pthread.h> struct rusage_t { @@ -84,6 +85,7 @@ struct thread_master int fd_limit; struct fd_handler handler; unsigned long alloc; + pthread_mutex_t mtx; }; typedef unsigned char thread_type; @@ -110,6 +112,7 @@ struct thread const char *funcname; const char *schedfrom; int schedfrom_line; + pthread_mutex_t mtx; }; struct cpu_thread_history |
