1 // Copyright 2013 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.
5 // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
8 #include "_cgo_export.h"
22 doAdd(int max, int nthread)
24 enum { MaxThread = 20 };
26 pthread_t thread_id[MaxThread];
28 if(nthread > MaxThread)
30 for(i=0; i<nthread; i++)
31 pthread_create(&thread_id[i], 0, addThread, &max);
32 for(i=0; i<nthread; i++)
33 pthread_join(thread_id[i], 0);
37 goDummyCallbackThread(void* p)
48 callGoInCThread(int max)
52 if (pthread_create(&thread, NULL, goDummyCallbackThread, (void*)(&max)) != 0)
54 if (pthread_join(thread, NULL) != 0)