Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multithread issue - attempted to read or write protected memory

Status
Not open for further replies.

yeller2

Programmer
Feb 8, 2007
69
US
Hello,

I've got a user control that executes a code while starting up. While this code is running, if I cause an event to fire that executes some of the code the startup executes, I get an "attempted to read or write protected memory" exception. I've tried using a lock(this) block, but it doesn't seem to work - should I create an instance of the thread class in the event handler and then run the code with the lock block?
 
nm. Figured it out - I had to get a common object to lock on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top