From b2140cb7c8620d51f55942d349612129f51d6552 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 6 Jan 2018 11:48:11 -0500 Subject: [PATCH] lib: Add pthread_yield Signed-off-by: Donald Sharp --- lib/frr_pthread.c | 6 ++++++ lib/frr_pthread.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 8b23640fa4..19dfbaf54b 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -19,6 +19,7 @@ #include #include +#include #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 9dee5fcca4..f6000340a7 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 -- 2.39.5