sem_init bug in CCTextureCache.cpp

sem_init bug in CCTextureCache.cpp
0.0 0


hi - the sem_init() call is not supported on ios. it will set errno and fail to create a semaphore, meaning the sem_wait() call in the main run loop will return immediately. only named semaphores (using sem_open) are supported. i’m not sure how this affects other platforms.


Does official Apple documents confirm it?


If you call sem_init the return val is –1, and if you check errno after the call it is set to 78 (Function not implemented). I haven’t seen any other documentation about it.


I can confirm this as well, using the async texture loader will put the loading thread into a busy loop as the semaphore call fails instantly.
On an iPad2 I had about 120-150 CPU usage with the loading thread active (and idle) and about 20-30 without.
It wasn’t really affecting performance as this happend on the 2nd core, but may drain the battery a lot.


Thank you.

#1214 is created for it.