1
// Copyright 2009 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
11
static void* threadentry(void*);
12
static void (*setmg_gcc)(void*, void*);
15
x_cgo_init(G *g, void (*setmg)(void*, void*))
21
pthread_attr_init(&attr);
22
pthread_attr_getstacksize(&attr, &size);
23
g->stackguard = (uintptr)&attr - size + 4096;
24
pthread_attr_destroy(&attr);
29
_cgo_sys_thread_start(ThreadStart *ts)
38
sigprocmask(SIG_SETMASK, &ign, &oset);
40
pthread_attr_init(&attr);
41
pthread_attr_getstacksize(&attr, &size);
42
ts->g->stackguard = size;
43
err = pthread_create(&p, &attr, threadentry, ts);
45
sigprocmask(SIG_SETMASK, &oset, nil);
48
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
58
ts = *(ThreadStart*)v;
61
ts.g->stackbase = (uintptr)&ts;
64
* _cgo_sys_thread_start set stackguard to stack size;
65
* change to actual guard pointer.
67
ts.g->stackguard = (uintptr)&ts - ts.g->stackguard + 4096;
72
setmg_gcc((void*)ts.m, (void*)ts.g);