Quick hand! The last parameter of WaitForMultipleObjects() is set to zero. It causes WaitForMultipleObjects() to return immediately. Just a dicussion.
-old(HH);
2001-6-2(#88560@0)
HH, how long no see.
-jabber(jabber);
2001-6-2(#88564@0)
Jabber, I am a reader of most of your postings.
-old(HH);
2001-6-2(#88574@0)
I always remember your helped me with my Javascript coding...Now I feel much better about Javascript.
-jabber(jabber);
2001-6-3(#88883@0)
Rien. (learned from you)
-old(HH);
2001-6-3(#89227@0)
De rien. Hahaha.... You made a mistake again.
-jabber(jabber);
2001-6-4(#89477@0)
De......
-old(HH);
2001-6-23(#110372@0)
oh, u r right, I misstaken it as infinate.
-blaise(blaise);
2001-6-3(#88610@0)
it's better to replace sleep() by singlelock. for putvalue: inputlock[in].lock;value[in] = i;ouputlock[in].unlock;in=(in+1)%QUEUESIZE. for getvalue: outputlock[out].lock;result = value[out];inputlock[out].unlock;out=(out+1)%QUEUESIZE.
-scorpio(scorpio);
2001-6-3(#89008@0)
I think the type of "n" in ...I think the type of "n" in your Thread1 should be unsigned or add some codes to limit its increasement (n++) in case it becomes negative,
and the shared memory should be synchronized. I am not very sure if it is no problem in practice of this specific implementation to access the shared memory without synchronization.
-old(HH);
2001-6-3{322}(#89012@0)
in case there is only one reader and one write, it's safe.
-blaise(blaise);
2001-6-4(#89337@0)
On my understanding of this matter, the reason for “safety” in this specific example could not be that there are only one reader and one writer. The reason could be that the statement which access “status”,e.g. “status=0;” or “status=1;”, is usually, if not always, compiled into a machine code instruction which is “atomic” when the machine's bits >= 8 * sizeof(int).
-old(HH);
2001-6-23{169}(#110371@0)