mirror of
https://github.com/golang/go
synced 2024-11-14 08:00:22 -07:00
6de014b9e2
Some tests cannot build for Android; use build tags and stubs to skip them. For #15919 Change-Id: Ieedcb73d4cabe23c3775cfb1d44c1276982dccd9 Reviewed-on: https://go-review.googlesource.com/23634 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
29 lines
535 B
C
29 lines
535 B
C
// Copyright 2014 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build !android
|
|
|
|
#include <pthread.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
static pthread_t thread;
|
|
|
|
static void* threadfunc(void* dummy) {
|
|
while(1) {
|
|
sleep(1);
|
|
}
|
|
}
|
|
|
|
int StartThread() {
|
|
return pthread_create(&thread, NULL, &threadfunc, NULL);
|
|
}
|
|
|
|
int CancelThread() {
|
|
void *r;
|
|
pthread_cancel(thread);
|
|
pthread_join(thread, &r);
|
|
return (r == PTHREAD_CANCELED);
|
|
}
|