Commit 651e2109 authored by deuce's avatar deuce
Browse files

Every *nix except QNX now uses XP semaphores... a POSIX semaphore lib

The semaphore emulation lib provides for sem_timedwait() which will allow
correct blocking calls to be used rather than bogus (On *nix anyways)
arbitrary 1-55ms (depending on hardware) wait during a loop to avoid 100%
CPU utilization.

The xpsem lib uses mutexes to provide semaphore functions and is taken
almost line-per-line from FreeBSD.  (copyright left intact)

**** WARNING ****
This commit was performed while drunk.  If this breaks your build, I
personally guarantee you get to keep all remaning pieces.
parent 00b55919
......@@ -104,12 +104,16 @@ ifeq ($(os),sunos) # Solaris
endif
ifeq ($(os),netbsd)
CFLAGS += -D_REENTRANT -DUSE_XP_SEMAPHORES -D__unix__ -I/usr/pkg/include -DNEEDS_FORKPTY
CFLAGS += -D_REENTRANT -D__unix__ -I/usr/pkg/include -DNEEDS_FORKPTY
LFLAGS := -lm -lpthread -L/usr/pkg/lib
endif
# So far, only QNX has sem_timedwait()
ifeq ($(os),qnx)
LFLAGS := -lm -lsocket
else
CFLAGS += -DUSE_XP_SEMAPHORES
USE_XP_SEMAPHORES := 1
endif
ifdef DEBUG
......@@ -150,13 +154,8 @@ include targets.mk # defines all targets
include objects.mk # defines $(OBJS)
include sbbsdefs.mk # defines $(SBBSDEFS)
ifeq ($(os),gnu)
CFLAGS += -DUSE_XP_SEMAPHORES -DNEEDS_FORKPTY -D_POSIX_THREADS
OBJS += $(LIBODIR)$(SLASH)sem.$(OFILE)
endif
ifeq ($(os),netbsd)
OBJS += $(LIBODIR)$(SLASH)xpsem.$(OFILE)
ifeq ($(USE_XP_SEMAPHORES),1)
OBJS += $(LIBODIR)$(SLASH)xpsem.$(OFILE)
endif
SBBSLIB = $(LIBODIR)/sbbs.a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment