Treading for console applications in VB.NET

F

fdmaxey

I have used threading in Windows applications successfully. I am trying
to write a console application using synchronized threads, as I don't
need any display or operator interface.

However, when I call Monitor.Wait on any thread created, an exception is
thrown with the following description:

"Object synchronization method was called from an unsynchronized block
of code."

I've searched for any statement on this, but there is nothing definitive
that says threading in a console application is not allowed. Some of
the code samples imply a console app.

Is threading (or at least synchronizing threads) simply not possible in
a console application?


Frank Maxey
 
B

Brian Gideon

Frank,

Monitor.Wait can only be called with the thread currently owns the
lock. That means a previous call to Monitor.Enter (or by using the
SyncLock keyword) has occurred.

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top