468,484 Members | 1,761 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,484 developers. It's quick & easy.

Why is Second Thread Blocked?

I have a solution with two projects.


Private m_Flagged As Boolean
Private WithEvents m_Project2 As New Project2

Private Sub WaitForFlag()
m_Flagged = False

Do While Not m_Flagged

MessageBox.Show("Event Occurred.")

End Sub

Private Sub FlagEvent(...) Handles m_Project2.EventOccurred
m_Flagged = True
End Sub


Public Event EventOccurred(...)

Private Sub WaitForEvent()

'If Some Event Occurred Then
RaiseEvent EventOccurred(...)
'End If

End Sub
WaitForEvent in Project2 is started on a new thread. The message in
WaitForFlag (Project1) is never displayed as the code stands above. If I
replace the Sleep(1) with DoEvents then it does get displayed.

I thought the whole point of executing on separate threads was that I didn't
need DoEvents anymore. Have I missed something?


Nov 20 '05 #1
0 633

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by djw | last post: by
4 posts views Thread by Dr. J | last post: by
13 posts views Thread by Paul | last post: by
14 posts views Thread by Joe | last post: by
3 posts views Thread by =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post: by
2 posts views Thread by gieforce | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.