Pthread.h missing include file

Pthread.h missing include file
0.0 0

#1

Hi,

I’ve created a simple HelloWorld app and wanted to try out threading. I found:
http://www.cocos2d-x.org/wiki/How_to_use_pthread

I pasted the code into HelloWorldScene.cpp but VS is complaining that it does not find the pthread include file.
Can you please tell me which file I need to include to get the pthread includes?

I can’t find it anywhere within the cocos installation - using cocos2d-x 3.14.1.

I also found a post explaining to use std::thread instead - that it is more portable. Why? On which platforms will pthread cause problems? Are there some ‘cocos’ threads (beside pthreads) I can/should use?

Best regards,

Samo


Background code execution?
#2

This doc is really old. use std::thread


#3

I did, thanks!

Maybe if someone could write in the link: pthread is deprecated, use std::thread instead :wink: