TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
H Xia
NA
6
0
Need a SignalAndWaitAll
Jul 28 2009 9:43 PM
Hi All,
I am trying to write code to sync between processes. Here is the piece of code:
setSignal(); // signal me (WaitHandle) first
if (!WaitHandle.WaitAll(mWaitHandles, timeout_ms, true)) // mWaitHandles is an array of named event handles
{
mLog.WriteLine("While wait for sync, it's timed out."); // better not reach here, so timeout_ms should be big
}
resetSignal(); // reset WaitHandle
My problem is that because setSignal() and WaitHandle.WaitAll() is not atomic, other processes could have reset Signal before I enter WaitAll(), then I have a deadlock or timeout. So I need a SignalAndWait() similar method SignalAndWaitAll(). Is there such construct? If not, can I create one?
Thanks for your consideration.
Reply
Answers (
3
)
AxShockwaveFlashObject unload movie/return to original state
How to develop opc server using c#?