Treading for console applications in VB.NET

  • Thread starter Thread starter fdmaxey
  • Start date Start date
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
 
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
 
Back
Top