From: David Lamparter Date: Wed, 12 Sep 2018 19:25:49 +0000 (+0200) Subject: lib: remove unused frr_pthread_yield() X-Git-Tag: frr-7.1-dev~341^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=64777f5d87e5e6a1b58e555f1e15849746808400;p=mirror%2Ffrr.git lib: remove unused frr_pthread_yield() OS-level yield is generally a bad and possibly dangerous idea. If the thread should be suspended, there should always be something to wait on, or it turns into busy waiting. And if it's "just giving something else the chance to run" - that's the kernel's job to determine, and the kernel will do so while considering priorities, cgroups, and whatnot. Let it do its job. Signed-off-by: David Lamparter --- diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 6541437f55..c1ce57e24e 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -205,11 +205,6 @@ void frr_pthread_stop_all() pthread_mutex_unlock(&frr_pthread_list_mtx); } -void frr_pthread_yield(void) -{ - (void)sched_yield(); -} - /* * ---------------------------------------------------------------------------- * Default Event Loop diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index 2a41de6d47..b9e60511d5 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -210,9 +210,6 @@ int frr_pthread_stop(struct frr_pthread *fpt, void **result); /* Stops all frr_pthread's. */ void frr_pthread_stop_all(void); -/* Yields the current thread of execution */ -void frr_pthread_yield(void); - #ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK #define pthread_condattr_setclock(A, B) #endif