Iam trying to understand and find solution to one of my problem .
Let me explain my logic and the blocking aspect in that.
There are two threads
Thread1 and Thread2 these two operate on globa buffer.
Thread1 generates global list gl , thread 2 uses it by copying it into its own local copy .
The global buffer is secured by mutex lock.
Here thread2 is in infinite loop like below
the thread2 would be waken up by thread1 by unlocking the mutex lock1.
global list copy to local list.
for(i=0;i<number of nodes in the list;i++)
process the local list
The blocking issue for me here is ,
prepare global list gl
lets take a case where thread2 is in processing the list ,
in the mean time if thread1 provides new global list ,
How will thread 2 behave,i am afraid that this will corrupt the local list ( as this is not secured by lock ) and also there is no mechanism to tell the thread 2 from thread 1 that to consider the new list .
How can i over come this problem .
You help would be highly appreciated.