This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Description
To repro see test_threads.py in ptvsd repo. Sample code below:
if platform.system() == 'Windows':
from ctypes import CFUNCTYPE, c_void_p, c_size_t, c_uint32, windll
thread_func_p = CFUNCTYPE(c_uint32, c_void_p)
thread_func = thread_func_p(foo) # must hold a reference to wrapper during the call
assert windll.kernel32.CreateThread(c_void_p(0), c_size_t(0), thread_func, c_void_p(0), c_uint32(0), c_void_p(0))
elif platform.system() == 'Linux' or platform.system() == 'Darwin':
from ctypes import CDLL, CFUNCTYPE, byref, c_void_p, c_ulong
from ctypes.util import find_library
libpthread = CDLL(find_library('libpthread'))
thread_func_p = CFUNCTYPE(c_void_p, c_void_p)
thread_func = thread_func_p(foo) # must hold a reference to wrapper during the call
assert not libpthread.pthread_create(byref(c_ulong(0)), c_void_p(0), thread_func, c_void_p(0))
Hover does not show anything for CreateThread and pthread_create