This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline changes into win32 branch. Now would be a good time
[perl5.git] / thread.h
index c9ec77e..2b8e636 100644 (file)
--- a/thread.h
+++ b/thread.h
@@ -128,6 +128,7 @@ struct thread *getTHR _((void));
 #  endif
 #endif
 
+
 #ifndef THREAD_RET_TYPE
 #  define THREAD_RET_TYPE      void *
 #  define THREAD_RET_CAST(p)   ((void *)(p))
@@ -203,30 +204,32 @@ struct thread {
     U8         Tlocalizing;
     COP *      Tcurcop;
 
-    CONTEXT *  Tcxstack;
+    PERL_CONTEXT *     Tcxstack;
     I32                Tcxstack_ix;
     I32                Tcxstack_max;
 
     AV *       Tcurstack;
     AV *       Tmainstack;
     JMPENV *   Ttop_env;
-    I32                Trunlevel;
 
     /* XXX Sort stuff, firstgv, secongv and so on? */
 
-    SV *       Toursv;
-    HV *       Tcvcache;
+    SV *       oursv;
+    HV *       cvcache;
     perl_thread        self;                   /* Underlying thread object */
     U32                flags;
-    AV *       specific;               /* Thread specific data (& magicals) */
+    AV *       magicals;               /* Per-thread magicals */
+    AV *       specific;               /* Thread-specific user data */
+    SV *       errsv;                  /* Backing SV for $@ */
+    HV *       errhv;                  /* HV for what was %@ in pp_ctl.c */
     perl_mutex mutex;                  /* For the fields others can change */
     U32                tid;
     struct thread *next, *prev;                /* Circular linked list of threads */
-
-#ifdef ADD_THREAD_INTERN
+    JMPENV     Tstart_env;             /* Top of top_env longjmp() chain */ 
+#ifdef HAVE_THREAD_INTERN
     struct thread_intern i;            /* Platform-dependent internals */
 #endif
-    char       trailing_nul;           /* For the sake of thrsv, t->Toursv */
+    char       trailing_nul;           /* For the sake of thrsv and oursv */
 };
 
 typedef struct thread *Thread;
@@ -239,10 +242,10 @@ typedef struct thread *Thread;
 #define THRf_ZOMBIE    3
 #define THRf_DEAD      4
 
-#define THRf_DIE_FATAL 8
+#define THRf_DID_DIE   8
 
 /* ThrSTATE(t) and ThrSETSTATE(t) must only be called while holding t->mutex */
-#define ThrSTATE(t) ((t)->flags)
+#define ThrSTATE(t) ((t)->flags & THRf_STATE_MASK)
 #define ThrSETSTATE(t, s) STMT_START {         \
        (t)->flags &= ~THRf_STATE_MASK;         \
        (t)->flags |= (s);                      \
@@ -305,16 +308,15 @@ typedef struct condpair {
 #undef chopset
 #undef formtarget
 #undef bodytarget
+#undef  start_env
 #undef toptarget
 #undef top_env
-#undef runlevel
 #undef in_eval
 #undef restartop
 #undef delaymagic
 #undef dirty
 #undef localizing
 
-#define oursv          (thr->Toursv)
 #define stack_base     (thr->Tstack_base)
 #define stack_sp       (thr->Tstack_sp)
 #define stack_max      (thr->Tstack_max)
@@ -359,6 +361,7 @@ typedef struct condpair {
 #define        rs              (thr->Trs)
 #define        last_in_gv      (thr->Tlast_in_gv)
 #define        ofs             (thr->Tofs)
+#define        ofslen          (thr->Tofslen)
 #define        defoutgv        (thr->Tdefoutgv)
 #define        chopset         (thr->Tchopset)
 #define        formtarget      (thr->Tformtarget)
@@ -379,9 +382,8 @@ typedef struct condpair {
 #define localizing     (thr->Tlocalizing)
 
 #define        top_env         (thr->Ttop_env)
-#define        runlevel        (thr->Trunlevel)
+#define start_env       (thr->Tstart_env)
 
-#define        cvcache         (thr->Tcvcache)
 #else
 /* USE_THREADS is not defined */
 #define MUTEX_LOCK(m)