Index: ossp-pkg/pth/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/pth/ChangeLog,v rcsdiff -q -kk '-r1.599' '-r1.600' -u '/v/ossp/cvs/ossp-pkg/pth/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/11/09 11:30:14 1.599 +++ ChangeLog 2002/11/09 16:29:26 1.600 @@ -21,6 +21,10 @@ Changes between 2.0b1 and 2.0b2 (08-Nov-2002 to xx-Nov-2002) + *) Fixed error handling in pth_init(3): it now correctly + returns an error instead of abort(3)'ing. + [Ralf S. Engelschall] + *) Added soft syscall mapping for nanosleep(3) and usleep(3) functions also to the Pthread API. [Ralf S. Engelschall] Index: ossp-pkg/pth/pth_lib.c RCS File: /v/ossp/cvs/ossp-pkg/pth/pth_lib.c,v rcsdiff -q -kk '-r1.54' '-r1.55' -u '/v/ossp/cvs/ossp-pkg/pth/pth_lib.c,v' 2>/dev/null --- pth_lib.c 2002/11/03 11:15:04 1.54 +++ pth_lib.c 2002/11/09 16:29:26 1.55 @@ -73,7 +73,10 @@ pth_syscall_init(); /* initialize the scheduler */ - pth_scheduler_init(); + if (!pth_scheduler_init()) { + pth_shield { pth_syscall_kill(); } + return pth_error(FALSE, EAGAIN); + } #ifdef PTH_EX /* optional support for exceptional handling */ @@ -94,6 +97,7 @@ pth_shield { pth_attr_destroy(t_attr); pth_scheduler_kill(); + pth_syscall_kill(); } return FALSE; } @@ -110,6 +114,7 @@ pth_shield { pth_attr_destroy(t_attr); pth_scheduler_kill(); + pth_syscall_kill(); } return FALSE; } Index: ossp-pkg/pth/pth_sched.c RCS File: /v/ossp/cvs/ossp-pkg/pth/pth_sched.c,v rcsdiff -q -kk '-r1.87' '-r1.88' -u '/v/ossp/cvs/ossp-pkg/pth/pth_sched.c,v' 2>/dev/null --- pth_sched.c 2002/11/09 16:07:52 1.87 +++ pth_sched.c 2002/11/09 16:29:26 1.88 @@ -47,16 +47,15 @@ static pth_time_t pth_loadtickgap = PTH_TIME(1,0); /* initialize the scheduler ingredients */ -intern void pth_scheduler_init(void) +intern int pth_scheduler_init(void) { /* create the internal signal pipe */ - if (pipe(pth_sigpipe) == -1) { - fprintf(stderr, "**Pth** INIT: Cannot create internal pipe: %s\n", - strerror(errno)); - abort(); - } - pth_fdmode(pth_sigpipe[0], PTH_FDMODE_NONBLOCK); - pth_fdmode(pth_sigpipe[1], PTH_FDMODE_NONBLOCK); + if (pipe(pth_sigpipe) == -1) + return pth_error(FALSE, errno); + if (pth_fdmode(pth_sigpipe[0], PTH_FDMODE_NONBLOCK) == PTH_FDMODE_ERROR) + return pth_error(FALSE, errno); + if (pth_fdmode(pth_sigpipe[1], PTH_FDMODE_NONBLOCK) == PTH_FDMODE_ERROR) + return pth_error(FALSE, errno); /* initialize the essential threads */ pth_sched = NULL; @@ -72,7 +71,8 @@ /* initialize load support */ pth_loadval = 1.0; pth_time_set(&pth_loadticknext, PTH_TIME_NOW); - return; + + return TRUE; } /* drop all threads (except for the currently active one) */