Threading Question

Bernie

Well-known member
Joined
Aug 13, 2007
Messages
98
Programming Experience
3-5
I have a program that performs a lengthy database import. I've put all the db loading code into a thread to keep from locking up the GUI during operation. The the thread has completed operation, it raises an Event.

My question; The code that catches the Event runs in which thread, the GUI thread or the db thread that raised the Event?

Thanks,
Bernie
PS: Are there any good books on threading that you would recommend? I'd like to upgrade my knowledge in this area.
 
The event is raised in the worker thread so any methods handling that event will be executed in the worker thread.

I would suggest that you use a BackgroundWorker to simply your life. The DoWork event handler is executed in a worker thread and the RunWorkerCompleted event handler is executed in the UI thread.
 
Back
Top