简体   繁体   English

pthread_tryjoin_np? 有Windows版本吗?

[英]pthread_tryjoin_np? Is there a Windows version of it?

pthread_tryjoin_np is non portable. pthread_tryjoin_np是不可移植的。 Is there a Windows version of it of some kind? 有某种Windows版本吗? To create a thread but without blocking? 要创建线程但没有阻塞?

In windows CreateThread gives you a HANDLE which you can wait for to learn when the thread exits - which is similar to pthread_tryjoin on posix platforms. 在Windows中, CreateThread为您提供一个句柄,您可以等待该句柄来了解线程退出的时间-与posix平台上的pthread_tryjoin相似。

To wait with a timeout, or poll for exit of the thread, which is what pthread_tryjoin_np usually does (_np stands for non-portable, so there might be various variation of that function) you use WaitForSingleObject with the HANDLE of the thread. 要等待超时或轮询线程退出,这是pthread_tryjoin_np通常执行的操作(_np表示不可移植,因此该函数可能会有各种变化),请使用WaitForSingleObject和线程的HANDLE。

Althought not in the current official realease (2.9.1 as of May 27th 2012) pthread_tryjoin() is in the current trunk on https://sourceware.org/cgi-bin/cvsweb.cgi/pthreads/?cvsroot=pthreads-win32 尽管目前不在官方版本中(2012年5月27日为2.9.1),但pthread_tryjoin()位于https://sourceware.org/cgi-bin/cvsweb.cgi/pthreads/?cvsroot=pthreads-win32的当前主干中

Please see the ChangeLog here: https://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/pthreads/ChangeLog?rev=1.370&content-type=text/plain&cvsroot=pthreads-win32 请在此处查看ChangeLog: https ://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/pthreads/ChangeLog ? rev = 1.370 & content-type = text/plain & cvsroot = pthreads-win32

You can pull the sources using CVS like this 您可以像这样使用CVS提取源

cvs -d :pserver:anonymous@sourceware.org:/cvs/pthreads-win32 checkout pthreads

They should build using VC Express or MinGW gcc. 他们应该使用VC Express或MinGW gcc进行构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM