My guess is your problem is related to having two threads. Can we see the code of the worker thread?