LEFT | RIGHT |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <pthread.h> | 5 #include <pthread.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include "libcgo.h" | 8 #include "libcgo.h" |
9 | 9 |
10 static void *threadentry(void*); | 10 static void *threadentry(void*); |
(...skipping 18 matching lines...) Expand all Loading... |
29 memset(&attr, 0, sizeof attr); | 29 memset(&attr, 0, sizeof attr); |
30 pthread_attr_init(&attr); | 30 pthread_attr_init(&attr); |
31 size = 0; | 31 size = 0; |
32 pthread_attr_getstacksize(&attr, &size); | 32 pthread_attr_getstacksize(&attr, &size); |
33 ts->g->stackguard = size; | 33 ts->g->stackguard = size; |
34 err = pthread_create(&p, &attr, threadentry, ts); | 34 err = pthread_create(&p, &attr, threadentry, ts); |
35 | 35 |
36 pthread_sigmask(SIG_SETMASK, &oset, nil); | 36 pthread_sigmask(SIG_SETMASK, &oset, nil); |
37 | 37 |
38 if (err != 0) { | 38 if (err != 0) { |
39 » » fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", stre
rror(err)); | 39 » » fatalf("pthread_create failed: %s", strerror(err)); |
40 » » abort(); | |
41 } | 40 } |
42 } | 41 } |
43 | 42 |
44 extern void crosscall_arm1(void (*fn)(void), void (*setg_gcc)(void*), void *g); | 43 extern void crosscall_arm1(void (*fn)(void), void (*setg_gcc)(void*), void *g); |
45 static void* | 44 static void* |
46 threadentry(void *v) | 45 threadentry(void *v) |
47 { | 46 { |
48 ThreadStart ts; | 47 ThreadStart ts; |
49 | 48 |
50 ts = *(ThreadStart*)v; | 49 ts = *(ThreadStart*)v; |
(...skipping 22 matching lines...) Expand all Loading... |
73 setg_gcc = setg; | 72 setg_gcc = setg; |
74 pthread_attr_init(&attr); | 73 pthread_attr_init(&attr); |
75 pthread_attr_getstacksize(&attr, &size); | 74 pthread_attr_getstacksize(&attr, &size); |
76 g->stackguard = (uintptr)&attr - size + 4096; | 75 g->stackguard = (uintptr)&attr - size + 4096; |
77 pthread_attr_destroy(&attr); | 76 pthread_attr_destroy(&attr); |
78 | 77 |
79 if (x_cgo_inittls) { | 78 if (x_cgo_inittls) { |
80 x_cgo_inittls(tlsg, tlsbase); | 79 x_cgo_inittls(tlsg, tlsbase); |
81 } | 80 } |
82 } | 81 } |
LEFT | RIGHT |