github.com/bir3/gocompiler@v0.9.2202/src/cmd/cgo/internal/test/issue8517_windows.c (about)

     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  #include "windows.h"
     6  
     7  extern void testHandleLeaksCallback();
     8  
     9  DWORD WINAPI testHandleLeaksFunc(LPVOID lpThreadParameter)
    10  {
    11  	int i;
    12  	for(i = 0; i < 100; i++) {
    13  		testHandleLeaksCallback();
    14  	}
    15  	return 0;
    16  }
    17  
    18  void testHandleLeaks()
    19  {
    20  	HANDLE h;
    21  	h = CreateThread(NULL, 0, &testHandleLeaksFunc, 0, 0, NULL);
    22  	WaitForSingleObject(h, INFINITE);
    23  	CloseHandle(h);
    24  }