|
Question on return value of al_create_thread |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Anyone know what the void* return value is for? What are you supposed to return from your thread process? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
l j
Member #10,584
January 2009
|
I believe it's just whatever you want to return.
|
GullRaDriel
Member #3,861
September 2003
|
Your supposed to return the thread id so another thread can manage it and eventually stall/cancel it. Edit: seeing the prototype and the definition, I think the documentation is somewhat wrong. // does not really return 'true' but a valid ALLEGRO_THREAD or NULL; imho ALLEGRO_THREAD *al_create_thread(void *(*proc)(ALLEGRO_THREAD *thread, void *arg), void *arg)
"Code is like shit - it only smells if it is not yours" |
Thomas Fjellstrom
Member #476
June 2000
|
GullRaDriel said: Your supposed to return the thread id so another thread can manage it and eventually stall/cancel it. Once you return from your function, the thread is done. So that wouldn't really do what you think -- |
Matthew Leverton
Supreme Loser
January 1999
|
GullRaDriel said: Edit: seeing the prototype and the definition, I think the documentation is somewhat wrong. This discussion is about the return value of the proc callback (i.e., the thread function), not the return value of al_create_thread() (which is what you are describing). |
Edgar Reynaldo
Major Reynaldo
May 2007
|
al_create_thread said: Spawn a new thread which begins executing proc. The new thread is passed its own thread handle and the value arg. Returns true if the thread was created, false if there was an error. Well, it doesn't actually begin executing proc until you call al_start_thread. And it doesn't return true, it's a pointer to a newly created ALLEGRO_THREAD or zero (null) like Gull said. It would sound better like : Create a new thread which will run proc later when you call al_start_thread. The thread is passed its own thread handle and the value arg. Returns a pointer to a newly created ALLEGRO_THREAD, or NULL if there was an error. How does that sound? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
GullRaDriel
Member #3,861
September 2003
|
I feel understood. Thanks Edgar. The two other are just reluctant trolls ;-p "Code is like shit - it only smells if it is not yours" |
Thomas Fjellstrom
Member #476
June 2000
|
GullRaDriel said: I feel understood. Thanks Edgar. The two other are just reluctant trolls ;-p Actually, I just didn't really understand what you were trying to say. -- |
l j
Member #10,584
January 2009
|
Apparently I'm incapable of parsing human languages.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Don't worry, you're not the only one with poor reading comprehension. Sometimes I think my brain just makes up what other people said. What format are Allegro's docs in? I will submit a patch if its not too complex. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Thomas Fjellstrom
Member #476
June 2000
|
To be honest, I had assumed Gull was talking about the user function, because you (Edgar) were. I don't think that's an entirely unreasonable thing to think. -- |
Elias
Member #358
May 2000
|
Edgar Reynaldo said: What format are Allegro's docs in? I will submit a patch if its not too complex. The documentation is written in markdown (processed by pandoc). This particular function is documented here: http://sourceforge.net/p/alleg/allegro/ci/5.1/tree/docs/src/refman/threads.txt It's just a simple wiki format, so you should be able to create a patch without actually installing pandoc. -- |
|