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
roy doron
NA
33
20.4k
Assign Mutex to each Thread
May 25 2013 11:14 AM
Hello,
I have a function, and i would like to let a list/array of Threads run parallel in it (inorder to protect critical sections in it).
I thought I'd create List<Mutex> and assign each one to a different Thread:
for( int i =0; i<10; i++)
{ arrmutex[i] = new mutex(); }
and in the function i would like to lock with a arrmutex.elementAt(someThread).waitOne() -> a specific variable
It tells me that i cannot do that cause my mutex list is not initialize, AND, the lock wouldn't work..
Can you please help me figure out, how to initialize a list/array of mutexes?
and how to assign each thread a mutex?
Thanks,
Reply
Answers (
3
)
Functioning of Enter, Escape and Backspace Keys in Textbox
best way to maximize parallelity in multi Threaded program?