* src/threads/threads-common.c (vmcore/options.h): Fixed include.
[cacao.git] / src / threads / threads-common.c
1 /* src/threads/threads-common.c - machine independent thread functions
2
3    Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25 */
26
27
28 #include "config.h"
29
30 #include <assert.h>
31 #include <stdint.h>
32 #include <unistd.h>
33
34 #include "vm/types.h"
35
36 #include "mm/memory.h"
37
38 #include "native/jni.h"
39 #include "native/llni.h"
40
41 #include "native/include/java_lang_Object.h"
42 #include "native/include/java_lang_String.h"
43 #include "native/include/java_lang_Thread.h"
44
45 #if defined(WITH_CLASSPATH_GNU)
46 # include "native/include/java_lang_VMThread.h"
47 #endif
48
49 #include "threads/critical.h"
50 #include "threads/lock-common.h"
51 #include "threads/threads-common.h"
52
53 #include "toolbox/list.h"
54
55 #include "vm/builtin.h"
56 #include "vm/stringlocal.h"
57 #include "vm/vm.h"
58
59 #include "vm/jit/stacktrace.h"
60
61 #include "vmcore/class.h"
62 #include "vmcore/options.h"
63
64 #if defined(ENABLE_STATISTICS)
65 # include "vmcore/statistics.h"
66 #endif
67
68 #include "vmcore/utf8.h"
69
70
71 /* global variables ***********************************************************/
72
73 /* global threads list */
74 static list_t *list_threads;
75
76 /* global threads free-list */
77
78 typedef struct thread_index_t {
79         int32_t    index;
80         listnode_t linkage;
81 } thread_index_t;
82
83 static list_t *list_free_thread_index;
84
85 #if defined(__LINUX__)
86 /* XXX Remove for exact-GC. */
87 bool threads_pthreads_implementation_nptl;
88 #endif
89
90
91 /* threads_preinit *************************************************************
92
93    Do some early initialization of stuff required.
94
95    ATTENTION: Do NOT use any Java heap allocation here, as gc_init()
96    is called AFTER this function!
97
98 *******************************************************************************/
99
100 void threads_preinit(void)
101 {
102         threadobject *mainthread;
103 #if defined(__LINUX__) && defined(_CS_GNU_LIBPTHREAD_VERSION)
104         char         *pathbuf;
105         size_t        len;
106 #endif
107
108 #if defined(__LINUX__)
109         /* XXX Remove for exact-GC. */
110
111         /* On Linux we need to check the pthread implementation. */
112
113         /* _CS_GNU_LIBPTHREAD_VERSION (GNU C library only; since glibc 2.3.2) */
114         /* If the glibc is a pre-2.3.2 version, we fall back to
115            linuxthreads. */
116
117 # if defined(_CS_GNU_LIBPTHREAD_VERSION)
118         len = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, (size_t) 0);
119
120         /* Some systems return as length 0 (maybe cross-compilation
121            related).  In this case we also fall back to linuxthreads. */
122
123         if (len > 0) {
124                 pathbuf = MNEW(char, len);
125
126                 (void) confstr(_CS_GNU_LIBPTHREAD_VERSION, pathbuf, len);
127
128                 if (strstr(pathbuf, "NPTL") != NULL)
129                         threads_pthreads_implementation_nptl = true;
130                 else
131                         threads_pthreads_implementation_nptl = false;
132         }
133         else
134                 threads_pthreads_implementation_nptl = false;
135 # else
136         threads_pthreads_implementation_nptl = false;
137 # endif
138 #endif
139
140         /* initialize the threads lists */
141
142         list_threads           = list_create(OFFSET(threadobject, linkage));
143         list_free_thread_index = list_create(OFFSET(thread_index_t, linkage));
144
145         /* Initialize the threads implementation (sets the thinlock on the
146            main thread). */
147
148         threads_impl_preinit();
149
150         /* create internal thread data-structure for the main thread */
151
152         mainthread = threads_thread_new();
153
154         /* thread is a Java thread and running */
155
156         mainthread->flags |= THREAD_FLAG_JAVA;
157         mainthread->state = THREAD_STATE_RUNNABLE;
158
159         /* store the internal thread data-structure in the TSD */
160
161         threads_set_current_threadobject(mainthread);
162
163         /* initialize locking subsystems */
164
165         lock_init();
166
167         /* initialize the critical section */
168
169         critical_init();
170 }
171
172
173 /* threads_list_first **********************************************************
174
175    Return the first entry in the threads list.
176
177    NOTE: This function does not lock the lists.
178
179 *******************************************************************************/
180
181 threadobject *threads_list_first(void)
182 {
183         threadobject *t;
184
185         t = list_first_unsynced(list_threads);
186
187         return t;
188 }
189
190
191 /* threads_list_next ***********************************************************
192
193    Return the next entry in the threads list.
194
195    NOTE: This function does not lock the lists.
196
197 *******************************************************************************/
198
199 threadobject *threads_list_next(threadobject *t)
200 {
201         threadobject *next;
202
203         next = list_next_unsynced(list_threads, t);
204
205         return next;
206 }
207
208
209 /* threads_list_get_non_daemons ************************************************
210
211    Return the number of non-daemon threads.
212
213    NOTE: This function does a linear-search over the threads list,
214          because it's only used for joining the threads.
215
216 *******************************************************************************/
217
218 s4 threads_list_get_non_daemons(void)
219 {
220         threadobject *t;
221         s4            nondaemons;
222
223         /* lock the threads lists */
224
225         threads_list_lock();
226
227         nondaemons = 0;
228
229         for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
230                 if (!(t->flags & THREAD_FLAG_DAEMON))
231                         nondaemons++;
232         }
233
234         /* unlock the threads lists */
235
236         threads_list_unlock();
237
238         return nondaemons;
239 }
240
241
242 /* threads_thread_new **********************************************************
243
244    Allocates and initializes an internal thread data-structure and
245    adds it to the threads list.
246
247 *******************************************************************************/
248
249 threadobject *threads_thread_new(void)
250 {
251         thread_index_t *ti;
252         int32_t         index;
253         threadobject   *t;
254         
255         /* lock the threads-lists */
256
257         threads_list_lock();
258
259         /* Try to get a thread index from the free-list. */
260
261         ti = list_first_unsynced(list_free_thread_index);
262
263         /* Is a free thread index available? */
264
265         if (ti != NULL) {
266                 /* Yes, remove it from the free list, get the index and free
267                    the entry. */
268
269                 list_remove_unsynced(list_free_thread_index, ti);
270
271                 index = ti->index;
272
273                 FREE(ti, thread_index_t);
274
275 #if defined(ENABLE_STATISTICS)
276                 if (opt_stat)
277                         size_thread_index_t -= sizeof(thread_index_t);
278 #endif
279         }
280         else {
281                 /* Get a new the thread index. */
282
283                 index = list_threads->size + 1;
284         }
285
286         /* Allocate a thread data structure. */
287
288 #if defined(ENABLE_GC_BOEHM)
289         t = GCNEW_UNCOLLECTABLE(threadobject, 1);
290 #else
291         t = NEW(threadobject);
292 #endif
293
294 #if defined(ENABLE_STATISTICS)
295         if (opt_stat)
296                 size_threadobject += sizeof(threadobject);
297 #endif
298
299         /* Clear memory. */
300
301         MZERO(t, threadobject, 1);
302
303 #if defined(ENABLE_GC_CACAO)
304         /* Register reference to java.lang.Thread with the GC. */
305
306         gc_reference_register(&(t->object), GC_REFTYPE_THREADOBJECT);
307         gc_reference_register(&(t->_exceptionptr), GC_REFTYPE_THREADOBJECT);
308 #endif
309
310         /* Pre-compute the thinlock-word. */
311
312         assert(index != 0);
313
314         t->index     = index;
315         t->thinlock  = lock_pre_compute_thinlock(t->index);
316         t->flags     = 0;
317         t->state     = THREAD_STATE_NEW;
318
319 #if defined(ENABLE_GC_CACAO)
320         t->flags    |= THREAD_FLAG_IN_NATIVE; 
321 #endif
322
323         /* Initialize the implementation-specific bits. */
324
325         threads_impl_thread_new(t);
326
327         /* Add the thread to the threads-list. */
328
329         list_add_last_unsynced(list_threads, t);
330
331         /* Unlock the threads-lists. */
332
333         threads_list_unlock();
334
335         return t;
336 }
337
338
339 /* threads_thread_free *********************************************************
340
341    Remove the thread from the threads-list and free the internal
342    thread data structure.  The thread index is added to the
343    thread-index free-list.
344
345    IN:
346        t....thread data structure
347
348 *******************************************************************************/
349
350 void threads_thread_free(threadobject *t)
351 {
352         thread_index_t *ti;
353
354         /* Lock the threads lists. */
355
356         threads_list_lock();
357
358         /* Cleanup the implementation specific bits. */
359
360         threads_impl_thread_free(t);
361
362         /* Remove the thread from the threads-list. */
363
364         list_remove_unsynced(list_threads, t);
365
366         /* Add the thread index to the free list. */
367
368         ti = NEW(thread_index_t);
369
370 #if defined(ENABLE_STATISTICS)
371         if (opt_stat)
372                 size_thread_index_t += sizeof(thread_index_t);
373 #endif
374
375         ti->index = t->index;
376
377         list_add_last_unsynced(list_free_thread_index, ti);
378
379         /* Free the thread data structure. */
380
381 #if defined(ENABLE_GC_BOEHM)
382         GCFREE(t);
383 #else
384         FREE(t, threadobject);
385 #endif
386
387 #if defined(ENABLE_STATISTICS)
388         if (opt_stat)
389                 size_threadobject -= sizeof(threadobject);
390 #endif
391
392         /* Unlock the threads lists. */
393
394         threads_list_unlock();
395 }
396
397
398 /* threads_thread_start_internal ***********************************************
399
400    Start an internal thread in the JVM.  No Java thread objects exists
401    so far.
402
403    IN:
404       name.......UTF-8 name of the thread
405       f..........function pointer to C function to start
406
407 *******************************************************************************/
408
409 bool threads_thread_start_internal(utf *name, functionptr f)
410 {
411         threadobject       *t;
412         java_lang_Thread   *object;
413 #if defined(WITH_CLASSPATH_GNU)
414         java_lang_VMThread *vmt;
415 #endif
416
417         /* Enter the join-mutex, so if the main-thread is currently
418            waiting to join all threads, the number of non-daemon threads
419            is correct. */
420
421         threads_mutex_join_lock();
422
423         /* create internal thread data-structure */
424
425         t = threads_thread_new();
426
427         t->flags |= THREAD_FLAG_INTERNAL | THREAD_FLAG_DAEMON;
428
429         /* The thread is flagged as (non-)daemon thread, we can leave the
430            mutex. */
431
432         threads_mutex_join_unlock();
433
434         /* create the java thread object */
435
436         object = (java_lang_Thread *) builtin_new(class_java_lang_Thread);
437
438         /* XXX memory leak!!! */
439         if (object == NULL)
440                 return false;
441
442 #if defined(WITH_CLASSPATH_GNU)
443         vmt = (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
444
445         /* XXX memory leak!!! */
446         if (vmt == NULL)
447                 return false;
448
449         LLNI_field_set_ref(vmt, thread, object);
450         LLNI_field_set_val(vmt, vmdata, (java_lang_Object *) t);
451
452         LLNI_field_set_ref(object, vmThread, vmt);
453 #elif defined(WITH_CLASSPATH_CLDC1_1)
454         LLNI_field_set_val(object, vm_thread, (java_lang_Object *) t);
455 #endif
456
457         t->object = LLNI_DIRECT(object);
458
459         /* set java.lang.Thread fields */
460
461 #if defined(WITH_CLASSPATH_GNU)
462         LLNI_field_set_ref(object, name    , (java_lang_String *) javastring_new(name));
463 #elif defined(WITH_CLASSPATH_CLDC1_1)
464         /* FIXME: In cldc the name is a char[] */
465 /*      LLNI_field_set_ref(object, name    , (java_chararray *) javastring_new(name)); */
466         LLNI_field_set_ref(object, name    , NULL);
467 #endif
468
469 #if defined(ENABLE_JAVASE)
470         LLNI_field_set_val(object, daemon  , true);
471 #endif
472
473         LLNI_field_set_val(object, priority, NORM_PRIORITY);
474
475         /* start the thread */
476
477         threads_impl_thread_start(t, f);
478
479         /* everything's ok */
480
481         return true;
482 }
483
484
485 /* threads_thread_start ********************************************************
486
487    Start a Java thread in the JVM.  Only the java thread object exists
488    so far.
489
490    IN:
491       object.....the java thread object java.lang.Thread
492
493 *******************************************************************************/
494
495 void threads_thread_start(java_handle_t *object)
496 {
497         java_lang_Thread   *o;
498         threadobject       *thread;
499 #if defined(WITH_CLASSPATH_GNU)
500         java_lang_VMThread *vmt;
501 #endif
502
503         o = (java_lang_Thread *) object;
504
505         /* Enter the join-mutex, so if the main-thread is currently
506            waiting to join all threads, the number of non-daemon threads
507            is correct. */
508
509         threads_mutex_join_lock();
510
511         /* create internal thread data-structure */
512
513         thread = threads_thread_new();
514
515         /* this is a normal Java thread */
516
517         thread->flags |= THREAD_FLAG_JAVA;
518
519 #if defined(ENABLE_JAVASE)
520         /* is this a daemon thread? */
521
522         if (LLNI_field_direct(o, daemon) == true)
523                 thread->flags |= THREAD_FLAG_DAEMON;
524 #endif
525
526         /* The thread is flagged and (non-)daemon thread, we can leave the
527            mutex. */
528
529         threads_mutex_join_unlock();
530
531         /* link the two objects together */
532
533         thread->object = LLNI_DIRECT(object);
534
535 #if defined(WITH_CLASSPATH_GNU)
536         LLNI_field_get_ref(o, vmThread, vmt);
537
538         assert(vmt);
539         assert(LLNI_field_direct(vmt, vmdata) == NULL);
540
541         LLNI_field_set_val(vmt, vmdata, (java_lang_Object *) thread);
542 #elif defined(WITH_CLASSPATH_CLDC1_1)
543         LLNI_field_set_val(o, vm_thread, (java_lang_Object *) thread);
544 #endif
545
546         /* Start the thread.  Don't pass a function pointer (NULL) since
547            we want Thread.run()V here. */
548
549         threads_impl_thread_start(thread, NULL);
550 }
551
552
553 /* threads_thread_print_info ***************************************************
554
555    Print information of the passed thread.
556    
557 *******************************************************************************/
558
559 void threads_thread_print_info(threadobject *t)
560 {
561         java_lang_Thread *object;
562 #if defined(WITH_CLASSPATH_GNU)
563         java_lang_String *namestring;
564 #endif
565         utf              *name;
566
567         assert(t->state != THREAD_STATE_NEW);
568
569         /* the thread may be currently in initalization, don't print it */
570
571         object = (java_lang_Thread *) LLNI_WRAP(t->object);
572
573         if (object != NULL) {
574                 /* get thread name */
575
576 #if defined(WITH_CLASSPATH_GNU)
577                 LLNI_field_get_ref(object, name, namestring);
578                 name = javastring_toutf((java_handle_t *) namestring, false);
579 #elif defined(WITH_CLASSPATH_SUN) || defined(WITH_CLASSPATH_CLDC1_1)
580                 /* FIXME: In cldc the name is a char[] */
581 /*              name = object->name; */
582                 name = utf_null;
583 #else
584 # error unknown classpath configuration
585 #endif
586
587                 printf("\"");
588                 utf_display_printable_ascii(name);
589                 printf("\"");
590
591                 if (t->flags & THREAD_FLAG_DAEMON)
592                         printf(" daemon");
593
594                 printf(" prio=%d", LLNI_field_direct(object, priority));
595
596 #if SIZEOF_VOID_P == 8
597                 printf(" t=0x%016lx tid=0x%016lx (%ld)",
598                            (ptrint) t, (ptrint) t->tid, (ptrint) t->tid);
599 #else
600                 printf(" t=0x%08x tid=0x%08x (%d)",
601                            (ptrint) t, (ptrint) t->tid, (ptrint) t->tid);
602 #endif
603
604                 printf(" index=%d", t->index);
605
606                 /* print thread state */
607
608                 switch (t->state) {
609                 case THREAD_STATE_NEW:
610                         printf(" new");
611                         break;
612                 case THREAD_STATE_RUNNABLE:
613                         printf(" runnable");
614                         break;
615                 case THREAD_STATE_BLOCKED:
616                         printf(" blocked");
617                         break;
618                 case THREAD_STATE_WAITING:
619                         printf(" waiting");
620                         break;
621                 case THREAD_STATE_TIMED_WAITING:
622                         printf(" waiting on condition");
623                         break;
624                 case THREAD_STATE_TERMINATED:
625                         printf(" terminated");
626                         break;
627                 default:
628                         vm_abort("threads_thread_print_info: unknown thread state %d",
629                                          t->state);
630                 }
631         }
632 }
633
634
635 /* threads_get_current_tid *****************************************************
636
637    Return the tid of the current thread.
638    
639    RETURN VALUE:
640        the current tid
641
642 *******************************************************************************/
643
644 ptrint threads_get_current_tid(void)
645 {
646         threadobject *thread;
647
648         thread = THREADOBJECT;
649
650         /* this may happen during bootstrap */
651
652         if (thread == NULL)
653                 return 0;
654
655         return (ptrint) thread->tid;
656 }
657
658
659 /* threads_thread_state_runnable ***********************************************
660
661    Set the current state of the given thread to THREAD_STATE_RUNNABLE.
662
663    NOTE: If the thread has already terminated, don't set the state.
664          This is important for threads_detach_thread.
665
666 *******************************************************************************/
667
668 void threads_thread_state_runnable(threadobject *t)
669 {
670         /* Set the state inside a lock. */
671
672         threads_list_lock();
673
674         if (t->state != THREAD_STATE_TERMINATED)
675                 t->state = THREAD_STATE_RUNNABLE;
676
677         DEBUGTHREADS("is RUNNABLE", t);
678
679         threads_list_unlock();
680 }
681
682
683 /* threads_thread_state_waiting ************************************************
684
685    Set the current state of the given thread to THREAD_STATE_WAITING.
686
687    NOTE: If the thread has already terminated, don't set the state.
688          This is important for threads_detach_thread.
689
690 *******************************************************************************/
691
692 void threads_thread_state_waiting(threadobject *t)
693 {
694         /* Set the state inside a lock. */
695
696         threads_list_lock();
697
698         if (t->state != THREAD_STATE_TERMINATED)
699                 t->state = THREAD_STATE_WAITING;
700
701         DEBUGTHREADS("is WAITING", t);
702
703         threads_list_unlock();
704 }
705
706
707 /* threads_thread_state_timed_waiting ******************************************
708
709    Set the current state of the given thread to
710    THREAD_STATE_TIMED_WAITING.
711
712    NOTE: If the thread has already terminated, don't set the state.
713          This is important for threads_detach_thread.
714
715 *******************************************************************************/
716
717 void threads_thread_state_timed_waiting(threadobject *t)
718 {
719         /* Set the state inside a lock. */
720
721         threads_list_lock();
722
723         if (t->state != THREAD_STATE_TERMINATED)
724                 t->state = THREAD_STATE_TIMED_WAITING;
725
726         DEBUGTHREADS("is TIMED_WAITING", t);
727
728         threads_list_unlock();
729 }
730
731
732 /* threads_thread_state_terminated *********************************************
733
734    Set the current state of the given thread to
735    THREAD_STATE_TERMINATED.
736
737 *******************************************************************************/
738
739 void threads_thread_state_terminated(threadobject *t)
740 {
741         /* set the state in the lock */
742
743         threads_list_lock();
744
745         t->state = THREAD_STATE_TERMINATED;
746
747         DEBUGTHREADS("is TERMINATED", t);
748
749         threads_list_unlock();
750 }
751
752
753 /* threads_thread_get_state ****************************************************
754
755    Returns the current state of the given thread.
756
757 *******************************************************************************/
758
759 utf *threads_thread_get_state(threadobject *t)
760 {
761         utf *u;
762
763         switch (t->state) {
764         case THREAD_STATE_NEW:
765                 u = utf_new_char("NEW");
766                 break;
767         case THREAD_STATE_RUNNABLE:
768                 u = utf_new_char("RUNNABLE");
769                 break;
770         case THREAD_STATE_BLOCKED:
771                 u = utf_new_char("BLOCKED");
772                 break;
773         case THREAD_STATE_WAITING:
774                 u = utf_new_char("WAITING");
775                 break;
776         case THREAD_STATE_TIMED_WAITING:
777                 u = utf_new_char("TIMED_WAITING");
778                 break;
779         case THREAD_STATE_TERMINATED:
780                 u = utf_new_char("TERMINATED");
781                 break;
782         default:
783                 vm_abort("threads_get_state: unknown thread state %d", t->state);
784
785                 /* keep compiler happy */
786
787                 u = NULL;
788         }
789
790         return u;
791 }
792
793
794 /* threads_thread_is_alive *****************************************************
795
796    Returns if the give thread is alive.
797
798 *******************************************************************************/
799
800 bool threads_thread_is_alive(threadobject *t)
801 {
802         switch (t->state) {
803         case THREAD_STATE_NEW:
804         case THREAD_STATE_TERMINATED:
805                 return false;
806
807         case THREAD_STATE_RUNNABLE:
808         case THREAD_STATE_BLOCKED:
809         case THREAD_STATE_WAITING:
810         case THREAD_STATE_TIMED_WAITING:
811                 return true;
812
813         default:
814                 vm_abort("threads_thread_is_alive: unknown thread state %d", t->state);
815         }
816
817         /* keep compiler happy */
818
819         return false;
820 }
821
822
823 /* threads_dump ****************************************************************
824
825    Dumps info for all threads running in the JVM.  This function is
826    called when SIGQUIT (<ctrl>-\) is sent to CACAO.
827
828 *******************************************************************************/
829
830 void threads_dump(void)
831 {
832         threadobject *t;
833
834         /* XXX we should stop the world here */
835
836         /* lock the threads lists */
837
838         threads_list_lock();
839
840         printf("Full thread dump CACAO "VERSION":\n");
841
842         /* iterate over all started threads */
843
844         for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
845                 /* print thread info */
846
847                 printf("\n");
848                 threads_thread_print_info(t);
849                 printf("\n");
850
851                 /* print trace of thread */
852
853                 threads_thread_print_stacktrace(t);
854         }
855
856         /* unlock the threads lists */
857
858         threads_list_unlock();
859 }
860
861
862 /* threads_thread_print_stacktrace *********************************************
863
864    Print the current stacktrace of the current thread.
865
866 *******************************************************************************/
867
868 void threads_thread_print_stacktrace(threadobject *thread)
869 {
870         stackframeinfo   *sfi;
871         stacktracebuffer *stb;
872         s4                dumpsize;
873
874         /* mark start of dump memory area */
875
876         dumpsize = dump_size();
877
878         /* create a stacktrace for the passed thread */
879
880         sfi = thread->_stackframeinfo;
881
882         stb = stacktrace_create(sfi);
883
884         /* print stacktrace */
885
886         if (stb != NULL)
887                 stacktrace_print_trace_from_buffer(stb);
888         else {
889                 puts("\t<<No stacktrace available>>");
890                 fflush(stdout);
891         }
892
893         dump_release(dumpsize);
894 }
895
896
897 /* threads_print_stacktrace ****************************************************
898
899    Print the current stacktrace of the current thread.
900
901 *******************************************************************************/
902
903 void threads_print_stacktrace(void)
904 {
905         threadobject *thread;
906
907         thread = THREADOBJECT;
908
909         threads_thread_print_stacktrace(thread);
910 }
911
912
913 /*
914  * These are local overrides for various environment variables in Emacs.
915  * Please do not remove this and leave it at the end of the file, where
916  * Emacs will automagically detect them.
917  * ---------------------------------------------------------------------
918  * Local variables:
919  * mode: c
920  * indent-tabs-mode: t
921  * c-basic-offset: 4
922  * tab-width: 4
923  * End:
924  * vim:noexpandtab:sw=4:ts=4:
925  */