1// Copyright 2014 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.
4
5// +build !android
6
7#include <pthread.h>
8#include <stdio.h>
9#include <unistd.h>
10
11static pthread_t thread;
12
13static void* threadfunc(void* dummy) {
14	while(1) {
15		sleep(1);
16	}
17}
18
19int StartThread() {
20	return pthread_create(&thread, NULL, &threadfunc, NULL);
21}
22
23int CancelThread() {
24	void *r;
25	pthread_cancel(thread);
26	pthread_join(thread, &r);
27	return (r == PTHREAD_CANCELED);
28}
29