473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

exitContext of Monitor.wait

The documentation on MSDN for the overloaded Monitor.wait(object,timespan, bool) is:

Expand|Select|Wrap|Line Numbers
  1. public static bool Wait(
  2.     Object obj,
  3.     TimeSpan timeout,
  4.     bool exitContext
  5. )
Releases the lock on an object and blocks the current thread until it reacquires the lock. If the specified time-out interval elapses, the thread enters the ready queue. Optionally exits the synchronization domain for the synchronized context before the wait and reacquires the domain afterward.

I'm not sure if I missed anything. But my deduction is:

If exitContext is false, which means not to exit the synchronization domain -> the thread which calls wait will still hold the lock for the domain -> other thread will not be able to access objects in the domain -> other thread can not access the object and lock it in order to call pulse -> the original wait method will always be time out.

This is just too dumb...There must be something wrong about it. What happends behind the scene when you release the lock on an object in a domain and at the same time "not exit the domain"? Isn't there just one lock for all objects in the domain?

Thanks for help in advance!
Jun 25 '09 #1
1 2159
I guess maybe the object is not in the same synchronization domain as the current instance where this method is invoked on?
Jun 26 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Vinay C | last post by:
Hi, Can anyone clear me that, when should we use go for mutex, and in which situation should we opt for monitor, lock, semaphone and other objects, in a multithreaded application for synchronization...
1
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
11
by: Michi Henning | last post by:
Hi, I'm calling Monitor.Wait() from a console event handler. It's not working -- the call to Wait() immediately causes the process to exit. Is it impossible for some reason to call Wait() from...
25
by: vooose | last post by:
Suppose execution of a particular thread T1 hits Monitor.Enter(obj); //critical section and blocks at the first line. (ie someone else is in the critical section) Now suppose more threads...
12
by: Perecli Manole | last post by:
I am having some strange thread synchronization problems that require me to better understand the intricacies of Monitor.Wait/Pulse. I have 3 threads. Thread 1 does a Monitor.Wait in a SyncLock...
2
by: DeveloperX | last post by:
Hi, Below is a hacked up version of an example I found on MSDN. My only change was to add a third thread and some Sleeps. That's where my question(s) comes in. In the original it seems to work...
1
by: archana | last post by:
Hi all, can anyone tell me exact meaning of exitcontext of waithandle.waitany. What exactly synchronization domain means? i am having one windows application in which i creating some thread...
1
by: archana | last post by:
Hi all, can anyone tell me exact meaning of exitcontext of waithandle.waitany. What exactly synchronization domain means? i am having one windows application in which i creating some thread...
13
by: AliRezaGoogle | last post by:
Dear Members, I have a problem in the concepts of Monit.Enter and Monitor.Exit (Before everything I should say that I know how to solve this problem by using Monitor.Wait and I do not need a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.