diff options
-rw-r--r-- | lib/frr_pthread.c | 6 | ||||
-rw-r--r-- | lib/frr_pthread.h | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 8b23640fa..19dfbaf54 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -19,6 +19,7 @@ #include <zebra.h> #include <pthread.h> +#include <sched.h> #include "frr_pthread.h" #include "memory.h" @@ -182,3 +183,8 @@ unsigned int frr_pthread_get_id() { return next_id++; } + +void frr_pthread_yield(void) +{ + (void)sched_yield(); +} diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index 9dee5fcca..f6000340a 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -130,6 +130,9 @@ int frr_pthread_stop(unsigned int id, void **result); /* Stops all frr_pthread's. */ void frr_pthread_stop_all(void); +/* Yields the current thread of execution */ +void frr_pthread_yield(void); + /* Returns a unique identifier for use with frr_pthread_new(). * * Internally, this is an integer that increments after each call to this |