OSDN Git Service

* builtins.c, dbxout.c, varasm.c: Include tm_p.h.
[pf3gnuchains/gcc-fork.git] / boehm-gc / quick_threads.c
1 /*
2  * Support code for cooperative coop/quick threads.
3  * Copyright (c) 1998, 1999 Cygnus Solutions.
4  */
5
6 #include "boehm-config.h"
7
8 #ifdef QUICK_THREADS
9
10 #include "gc_priv.h"
11
12 #include "coop.h"
13
14 void GC_push_all_stacks (void)
15 {
16   coop_t *t;
17   ptr_t lo, hi;
18
19   t = coop_first_thread ();
20
21   if (t == NULL)
22     {
23       /* Threads haven't started, so mark the real stack.  */
24 #ifdef STACK_GROWS_DOWN
25       GC_push_all_stack( GC_approx_sp(), GC_stackbottom );
26 #else
27       GC_push_all_stack( GC_stackbottom, GC_approx_sp() );
28 #endif
29     }
30   else
31     {
32       for ( ; t != NULL; t = coop_next_thread (t))
33         {
34           if (t == coop_global_curr)
35             lo = GC_approx_sp ();
36           else
37             {
38               lo = t->top;
39               /* LO can be NULL when the new thread has not yet been
40                  used.  */
41               if (! lo)
42                 continue;
43             }
44           hi = t->base;
45
46 #ifdef STACK_GROWS_DOWN
47           GC_push_all_stack (lo, hi);
48 #else
49           GC_push_all_stack (hi, lo);
50 #endif
51         }
52     }
53 }
54
55 #endif /* QUICK_THREADS */