1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

- enable thread support in libobjc

- disable thread priorities in libobjc to avoid thread starvation issues
- major bump lib due to new link dependency on pthread
- link objc regress with -pthread
Tested on i386/amd64/powerpc/landisk/vax/sparc64/hppa. okay espie@
This commit is contained in:
kurt 2007-07-23 17:24:06 +00:00
parent a80ebaad2f
commit 14a5f6265b
4 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile.bsd-wrapper,v 1.4 2006/08/28 20:49:50 tsi Exp $
# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2007/07/23 17:24:06 kurt Exp $
LIB= objc
@ -44,8 +44,7 @@ SRCS=archive.c class.c encoding.c gc.c hash.c init.c linking.m misc.c \
nil_method.c NXConstStr.m Object.m objects.c Protocol.m sarray.c \
selector.c sendmsg.c thr.c
# XXX need to check how threads work.
SRCS+=thr-single.c
SRCS+=thr-posix.c
includes:
install -d -m 755 -o $(BINOWN) -g $(BINGRP) \

View File

@ -96,6 +96,7 @@ __objc_thread_detach(void (*func)(void *arg), void *arg)
int
__objc_thread_set_priority(int priority)
{
#ifndef __OpenBSD__
pthread_t thread_id = pthread_self();
int policy;
struct sched_param params;
@ -123,6 +124,7 @@ __objc_thread_set_priority(int priority)
if (pthread_setschedparam(thread_id, policy, &params) == 0)
return 0;
}
#endif
return -1;
}
@ -130,6 +132,9 @@ __objc_thread_set_priority(int priority)
int
__objc_thread_get_priority(void)
{
#ifdef __OpenBSD__
return OBJC_THREAD_INTERACTIVE_PRIORITY;
#else
int policy;
struct sched_param params;
@ -137,6 +142,7 @@ __objc_thread_get_priority(void)
return params.sched_priority;
else
return -1;
#endif
}
/* Yield our process time to another thread. */

View File

@ -1,2 +1,2 @@
major=3
major=4
minor=0

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.2 2005/04/18 17:45:46 miod Exp $
# $OpenBSD: Makefile,v 1.3 2007/07/23 17:24:06 kurt Exp $
.SUFFIXES: .m
@ -12,6 +12,6 @@ LINK.m?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
PROG= main
SRCS= main.m
LDADD= -lobjc
LDADD= -lobjc -pthread
.include <bsd.regress.mk>