OK Thanks.
I had tried that but I simply replaced the call to waitfordata with waitformultipleobjects and had forgotten to call resetevent. It all looks ok now.