aboutsummaryrefslogtreecommitdiff
path: root/tests/legacy/cgo_pthread_flag/cgo_pthread_flag.go
blob: 91233342255bd42cfa855f9c261f001fe494a476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package cgo_pthread_flag

/*
#include <pthread.h>

void* f(void* p) {
	*(int*) p = 42;
	return NULL;
}

int callFInBackground() {
	int x;
	pthread_t thread;
	pthread_create(&thread, NULL, f, &x);
	pthread_join(thread, NULL);
	return x;
}
*/
import "C"

// Wrapper for callFInBackground. We don't support using Cgo directly from
// tests yet.
func callFFromGo() int {
	return int(C.callFInBackground())
}