github.com/mdempsky/go@v0.0.0-20151201204031-5dd372bd1e70/misc/cgo/test/issue5337.go (about)

     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.
     4  
     5  // +build !windows
     6  
     7  package cgotest
     8  
     9  /*
    10  #include <signal.h>
    11  #include <pthread.h>
    12  
    13  static void *thread1(void *p) {
    14  	(void)p;
    15  	pthread_kill(pthread_self(), SIGPROF);
    16  	return NULL;
    17  }
    18  void test5337() {
    19  	pthread_t tid;
    20  	pthread_create(&tid, 0, thread1, NULL);
    21  	pthread_join(tid, 0);
    22  }
    23  */
    24  import "C"
    25  
    26  import "testing"
    27  
    28  // Verify that we can withstand SIGPROF received on foreign threads
    29  func test5337(t *testing.T) {
    30  	C.test5337()
    31  }