0
Reply

ManualResetEvent

aun_ee

aun_ee

Mar 26 2005 6:19 PM
3.1k
I have a thread that writes data every 1ms to an Arraylist and another thread Reading the data from that list. The Thread that that writes to an Arraylist is controlling the thread that is reading from the list by using ManualResetEvent reset member to signal the Readthread to wait. after it adds the data it uses ManualResetEvent set member to signal the read thread to start reading. Once read the data the read thread calls a functionX() that does manipulation and calculations with the data recieved. However, my program seems to work fine and I could see the correct time difference using QueryPerformanceCounter to monitor the time my program writes to the ArrayList, but when functionX() is added and when ReadThread calls the function time seems to be messing, in other words it seems WriteThread has to wait for sometime before it can write eventhough its calling ManualResetEvent reset() before it tries to write. Any Ideas what could be causing it. Should Recieve thread by locking the array list while its executing functionX() eventhough functionX() has nothing to with the list?