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
bram 0
NA
11
0
The Monitor class
May 7 2004 10:12 AM
I have some problems understanding the exact quirks of the Monitor class. What is the difference between the Wait/Pulse method of acquiring and releasing a lock and the Enter/Exit method?! I read that the following: [code] class A { private int counter; public void Hit() { lock(this) { counter++; } } [/code] was susceptible to errors, since two different threads could be executing the [b]counter++[/b] statement at the same time. I don't see how this could be the case, since in my understanding the second thread would wait for the lock on 'this' to be released. Therefore, the access to the [b]counter++[/b] statement would be synchronized. Probably I'm wrong but I don't see how... Any ideas would be greatly appreciated!
Reply
Answers (
0
)
Abort is not releasing memory
Pocket PC Exit Problem...(Challenge)