c++ pointers not being respected

Hi,

I have a problem, I have a code with threads (boost thread group) and this pointer ppa::Node *root; is there, now the pointer is being created in the main and in the threads the object pointed is being update, a Boolean if it has a sequence is being set to true and done some more things with it, but when it returns to main the pointer this root->has_sequence() has 0 as a value which can't be since in the threads is being updated correctly.

So my question is why is this happening? WhY does the object has a 0 when it should be a 1? There is something I'm overlooking?
Without any more details, there's a myriad of things that could possibly be going wrong. A race condition is a likely possibility.
How are you passing that pointer to the thread?
no is not the code is fine the mutex are working, I'm not passing to the thread, the objects are stored in a deque and then used, the problem is that this ponter in the main is not being updated to the new values
Last edited on
Get both threads to spit out the value of the address of the pointer (not the value of the pointer, but the location in memory of the pointer itself). If they're not the same pointer, they will have different addresses.
Thanks I found the problem, the address of the pointer was the same is not my code, it's the other code, so my threads are ok, it's now getting it to work this way instead of the usual, thank you.
Topic archived. No new replies allowed.