libgo/go/runtime/testdata/testprogcgo/threadpanic_windows.c
raw| 1 | // Copyright 2015 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 | #include <process.h> |
| 6 | #include <stdlib.h> |
| 7 | #include <stdio.h> |
| 8 | |
| 9 | void gopanic(void); |
| 10 | |
| 11 | static unsigned int __attribute__((__stdcall__)) |
| 12 | die(void* x) |
| 13 | { |
| 14 | gopanic(); |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | void |
| 19 | start(void) |
| 20 | { |
| 21 | if(_beginthreadex(0, 0, die, 0, 0, 0) != 0) |
| 22 | printf("_beginthreadex failed\n"); |
| 23 | } |