OSSP CVS Repository

ossp - Check-in [2801]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2801
Date: 2002-Nov-09 17:29:26 (local)
2002-Nov-09 16:29:26 (UTC)
User:rse
Branch:
Comment: Fixed error handling in pth_init(3): it now correctly returns an error instead of abort(3)'ing.
Tickets:
Inspections:
Files:
ossp-pkg/pth/ChangeLog      1.599 -> 1.600     4 inserted, 0 deleted
ossp-pkg/pth/pth_lib.c      1.54 -> 1.55     6 inserted, 1 deleted
ossp-pkg/pth/pth_sched.c      1.87 -> 1.88     9 inserted, 9 deleted

ossp-pkg/pth/ChangeLog 1.599 -> 1.600

--- 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]


ossp-pkg/pth/pth_lib.c 1.54 -> 1.55

--- 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;
     }


ossp-pkg/pth/pth_sched.c 1.87 -> 1.88

--- 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) */

CVSTrac 2.0.1