my problem is: i have a function that i pass a pointer to so that it can update a variable for me. when this function is called normally the variable updates and everything works fine.
BUT when i call this function *as a seperate thread*, and pass it the address of the variable, the function executes completely, but when it returns the variable is NOT updated.
*NOTE that this variable is a global variable*
now i was thinking (obviously dont know for sure though cause im new to multithreading) that i may be related to the fact that a new thread has its own stack created, and hence unable to access the variable?
also, could it maybe be that some OpenGL functions which i am calling in this new thread are not working because they are being called from a seperate thread to the one that OpenGL is mainly working/drawing??
could any of these be correct ?? and if so, how do i get around this?? or otherwise, does anyone have any idea why this is happening??
any help whatsoever would be so so so appreciated. thanks in advance.