OSSP CVS Repository

ossp - Difference in ossp-pkg/pth/pth_lib.c versions 1.47 and 1.48
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/pth/pth_lib.c 1.47 -> 1.48

--- pth_lib.c    2002/01/27 11:03:40     1.47
+++ pth_lib.c    2002/01/30 13:07:08     1.48
@@ -43,6 +43,18 @@
         pth_init();
 #endif
 
+#ifdef PTH_EX
+/* exception handling callback functions */
+static ex_ctx_t *pth_ex_ctx(void)
+{
+    return &(pth_current->ex_ctx);
+}
+static void pth_ex_terminate(ex_t *ex)
+{
+    pth_exit(ex->ex_value);
+}
+#endif
+
 /* initialize the package */
 int pth_init(void)
 {
@@ -60,6 +72,12 @@
     /* initialize the scheduler */
     pth_scheduler_init();
 
+#ifdef PTH_EX
+    /* optional support for exceptional handling */
+    __ex_ctx       = pth_ex_ctx;
+    __ex_terminate = pth_ex_terminate;
+#endif
+
     /* spawn the scheduler thread */
     t_attr = pth_attr_new();
     pth_attr_set(t_attr, PTH_ATTR_PRIO,         PTH_PRIO_MAX);
@@ -120,6 +138,10 @@
     pth_initialized = FALSE;
     pth_tcb_free(pth_sched);
     pth_tcb_free(pth_main);
+#ifdef PTH_EX
+    __ex_ctx       = __ex_ctx_default;
+    __ex_terminate = __ex_terminate_default;
+#endif
     pth_debug1("pth_kill: leave");
     return TRUE;
 }
@@ -262,6 +284,11 @@
     /* initialize mutex stuff */
     pth_ring_init(&t->mutexring);
 
+#ifdef PTH_EX
+    /* initialize exception handling context */
+    EX_CTX_INITIALIZE(&t->ex_ctx);
+#endif
+
     /* initialize the machine context of this new thread */
     if (t->stacksize > 0) { /* the "main thread" (indicated by == 0) is special! */
         if (!pth_mctx_set(&t->mctx, pth_spawn_trampoline,

CVSTrac 2.0.1