Changes: *) Make pth_poll(3) more compliant to POSIX.1-2001/SUSv3 poll(2). *) Make pth_select(3) more compliant to POSIX.1-2001/SUSv3 select(2). *) Replaced pth_event_occurred() with pth_event_status(). *) Add Autoconf option --with-fdsetsize=NUM for enlarging FD_SETSIZE. *) Added thread attribute PTH_ATTR_DISPATCHES. *) Added sub-API pth_uctx_* for user-space context switching. *) Add a Pth variant of the new POSIX pselect(2) function. *) Internally cleaned up the error handling macros. *) Added POSIX-compliant sanity checks for bad fds. *) Added pth_nanosleep() function. *) Allow a NULL name for pth_msgport_create() *) Completely rewrote the "hard syscall mapping". *) Added support to pth_poll(3) for POLLD{RD,WR}{NORM,BAND}. *) Fixed a long-standing termination bug in pth_exit(3). *) Upgraded to Autoconf 2.57, Shtool 1.6.2 and Libtool 1.4.3. *) Add optional support for OSSP ex based exception handling.
79 lines
2 KiB
Text
79 lines
2 KiB
Text
$NetBSD: patch-ag,v 1.5 2003/05/02 11:49:48 wiz Exp $
|
|
|
|
--- pth_lib.c.orig Wed Jan 1 15:45:06 2003
|
|
+++ pth_lib.c
|
|
@@ -37,10 +37,11 @@ long pth_version(void)
|
|
|
|
/* implicit initialization support */
|
|
intern int pth_initialized = FALSE;
|
|
+intern int pth_explicit_initialize = FALSE;
|
|
#if cpp
|
|
#define pth_implicit_init() \
|
|
if (!pth_initialized) \
|
|
- pth_init();
|
|
+ pth__init();
|
|
#endif
|
|
|
|
#ifdef PTH_EX
|
|
@@ -55,19 +56,13 @@ static void pth_ex_terminate(ex_t *ex)
|
|
}
|
|
#endif
|
|
|
|
-/* initialize the package */
|
|
-int pth_init(void)
|
|
+int pth__init(void)
|
|
{
|
|
pth_attr_t t_attr;
|
|
|
|
- /* support for implicit initialization calls
|
|
- and to prevent multiple explict initialization, too */
|
|
- if (pth_initialized)
|
|
- return pth_error(FALSE, EPERM);
|
|
- else
|
|
- pth_initialized = TRUE;
|
|
+ pth_initialized = TRUE;
|
|
|
|
- pth_debug1("pth_init: enter");
|
|
+ pth_debug1("pth__init: enter");
|
|
|
|
/* initialize syscall wrapping */
|
|
pth_syscall_init();
|
|
@@ -131,10 +126,29 @@ int pth_init(void)
|
|
pth_mctx_switch(&pth_main->mctx, &pth_sched->mctx);
|
|
|
|
/* came back, so let's go home... */
|
|
- pth_debug1("pth_init: leave");
|
|
+ pth_debug1("pth__init: leave");
|
|
return TRUE;
|
|
}
|
|
|
|
+/* initialize the package */
|
|
+int pth_init(void)
|
|
+{
|
|
+ int rv;
|
|
+
|
|
+ /* support for implicit initialization calls
|
|
+ and to prevent multiple explict initialization, too */
|
|
+ if (pth_initialized) {
|
|
+ /* if we've already explicitly initialized then error */
|
|
+ if (pth_explicit_initialize)
|
|
+ return pth_error(FALSE, EPERM);
|
|
+ rv = TRUE;
|
|
+ } else {
|
|
+ rv = pth__init();
|
|
+ pth_explicit_initialize = TRUE;
|
|
+ }
|
|
+ return rv;
|
|
+}
|
|
+
|
|
/* kill the package internals */
|
|
int pth_kill(void)
|
|
{
|
|
@@ -144,6 +158,7 @@ int pth_kill(void)
|
|
pth_thread_cleanup(pth_main);
|
|
pth_scheduler_kill();
|
|
pth_initialized = FALSE;
|
|
+ pth_explicit_initialize = FALSE;
|
|
pth_tcb_free(pth_sched);
|
|
pth_tcb_free(pth_main);
|
|
pth_syscall_kill();
|