Skip to content

Commit

Permalink
Get rid of outdated sched_yield.h temporary wrapper
Browse files Browse the repository at this point in the history
The main utility of "sched_yield.h" was to provide sched_yield() on
OS'ed which didn't have it back in 2007, such as OpenBSD and NetBSD.

Nowadays, the landscape is different, with the issue having been fixed
in both above OS'es.  Moreover, by getting rid of the wrapper, we avoid
"missing -DHAVE_SCHED_YIELD" problems on architectures such as ARM (see
commit f8ad265, where the issue was caused by this wrapper header
exclusively).
  • Loading branch information
liviuchircu committed Jun 23, 2023
1 parent f69b150 commit a2d72ba
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 69 deletions.
14 changes: 6 additions & 8 deletions Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ LIBS+= -ldl -lresolv

#os specific stuff
ifeq ($(OS), linux)
DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
-DHAVE_TIMEGM
ifneq ($(found_lock_method), yes)
Expand Down Expand Up @@ -1449,7 +1449,7 @@ ifeq ($(OS), linux)
endif

ifeq ($(OS), gnu_kfreebsd)
DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
-DHAVE_TIMEGM
ifneq ($(found_lock_method), yes)
Expand All @@ -1468,7 +1468,7 @@ ifeq ($(OS), gnu_kfreebsd)
endif

ifeq ($(OS), solaris)
DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD \
DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H \
-DHAVE_ALLOCA_H -DUSE_SIGACTION -D_POSIX_PTHREAD_SEMANTICS
ifneq ($(found_lock_method), yes)
DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
Expand Down Expand Up @@ -1509,9 +1509,8 @@ endif

ifeq ($(OS), freebsd)
DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
-DHAVE_NETINET_IN_SYSTM
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_CONNECT_ECONNRESET_BUG \
-DHAVE_TIMEGM -DHAVE_NETINET_IN_SYSTM
LIBS= $(_SAVE_LIBS) #resolver & dlopen is in libc
ifneq ($(found_lock_method), yes)
DEFS+= -DUSE_PTHREAD_MUTEX # try pthread sems
Expand Down Expand Up @@ -1596,8 +1595,7 @@ endif
# OS X support, same as freebsd
ifeq ($(OS), darwin)
DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
-DUSE_ANON_MMAP \
-DHAVE_MSGHDR_MSG_CONTROL -DUSE_ANON_MMAP \
-DNDEBUG -DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM
# -DNDEBUG used to turn off assert (assert wants to call
# eprintf which doesn't seem to be defined in any shared lib
Expand Down
2 changes: 1 addition & 1 deletion fastlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#ifndef fastlock_h
#define fastlock_h

#include "sched_yield.h"
#include <sched.h>


#define SPIN_OPTIMIZE /* if defined optimize spining on the lock:
Expand Down
8 changes: 0 additions & 8 deletions modules/event_stream/event_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,4 @@
#define COLON_C ':'
#define SLASH_C '/'

#ifdef HAVE_SCHED_YIELD
#include <sched.h>
#else
#include <unistd.h>
/** Fake sched_yield if no unistd.h include is available */
#define sched_yield() sleep(0)
#endif /* HAVE_SCHED_YIELD */

#endif
8 changes: 0 additions & 8 deletions modules/event_xmlrpc/event_xmlrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,3 @@ struct xmlrpc_sock_param {
};

#endif

#ifdef HAVE_SCHED_YIELD
#include <sched.h>
#else
#include <unistd.h>
/** Fake sched_yield if no unistd.h include is available */
#define sched_yield() sleep(0)
#endif
1 change: 0 additions & 1 deletion pt.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sched.h>
#include <stdio.h>

#include "lib/dbg/profiling.h"
Expand Down
43 changes: 0 additions & 43 deletions sched_yield.h

This file was deleted.

0 comments on commit a2d72ba

Please sign in to comment.