|
Differences between al_run_detached_thread() and al_start_thread() |
AMCerasoli
Member #11,955
May 2010
|
Hi guys... I have a question about some threading functions, yes again...
threads : 15 al_create_thread() al_destroy_thread() al_create_thread() Threads : 17 So, all this crap is to know if I'm doing something bad, or if it is a normal behavior. In case I'm not doing something wrong, it's obvious that in my case would be better to use al_run_detached_thread(), since I don't need to close the thread for the main thread manually, am I right?.
|
Elias
Member #358
May 2000
|
I don't think al_create_thread and al_destroy_thread do anything but allocate/free the memory. al_start_thread will start the thread and it ends when you return from it. Would that explain the numbers you are seeing? -- |
Thomas Fjellstrom
Member #476
June 2000
|
As far as I can tell, al_create_thread actually spawns the thread, and it sits waiting for a condition variable fired by al_start_thread, then it launches into the user proc. I'm not entirely sure why the thread api is set up that way, but it is. -- |
AMCerasoli
Member #11,955
May 2010
|
Well, probably it's the Task Manager not being precise, I thought it was a reliable tool. Here's a video showing the normal game. And in this video some experiments that I can't understand. PS: I'm not creating another threads besides this, in my game, so, I think it could be Allegro, or the Task Manager not being precise.
|
Arthur Kalliokoski
Second in Command
February 2005
|
Have you tried Process Explorer? They all watch too much MSNBC... they get ideas. |
AMCerasoli
Member #11,955
May 2010
|
Wow, good tool. It's showing the same information than the Task Manager, though. The game always starts with 15 threads and if I let it alone some time (maybe 5 min) drops to 12 threads, when I call al_create_thread() it creates another thread, the Process Explorer shows its Start Address is "msvcrt.dll!_endthreadedx+0x29". But I have just realized that such thread also disappear after some minutes, so there is no problem. Thanks for the tool Arthur. Thanks to all.
|
|