473,405 Members | 2,167 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,405 software developers and data experts.

WaitHandle and Monitor

Is there any way to find out:
1. which thread is holding a monitor object?
2. how many Monitor.Enter() has been called on an object?
3. which WaitHandle is signaled after WaitHandle.WaitAny()?

Thanks.
Nov 15 '05 #1
1 2786
Hi,

See answers inline.
Is there any way to find out:
1. which thread is holding a monitor object? Not as far as I know.
2. how many Monitor.Enter() has been called on an object? No, if you want to use this to limit access to a resource you could
consider using a Semaphore.
Though .NET does not directly support Semaphore's they are easily
implemented. I have two implementations,
one that relies on the underlying OS Semaphore and a completely .NET
implementation. Each with there own
pros and cons. I will try to get them up asap and post a link.
3. which WaitHandle is signaled after WaitHandle.WaitAny()?

WaitAny returns an integer, this integer is the index of the handle in the
array that has been signalled

Hope this helps

--
Chris Taylor
http://www.xanga.com/home.aspx?user=taylorza
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pokémon | last post by:
Can someone please post a working example of how to use the WaitAny() method. Thanks.
1
by: Bob Rock | last post by:
Hello, did anyone notice that the WaitHandle class is not abstract as the ..NET SDK documentation says? Bob Rock
1
by: Tim | last post by:
Are AutoReset Event/ManualReset Event and Monitor.Pulse used for the same purpose? Can they be used interchangeably?
1
by: Larry Lard | last post by:
Just now I translated Jon Skeet's WaitHandle.WaitAny / .WaitAll (<http://yoda.arachsys.com/csharp/threads/waithandles.shtml>) from C# into VB.NET, and after the first go I ran into trouble: ...
0
by: Amir Shitrit | last post by:
Hi to all. What is difference between the methods found in the Monitor, Interlocked and WaitHandle classes in terms of performance? Is it true that Monitor.Wait uses the Interlocked class behind...
1
by: Sean | last post by:
I am looking at using delegates to perform an asynchronous call. There will be a callback invoked at the end of the call. The client thread will wait on the WaitHandle from IAsyncResult (which is...
14
by: Dave Booker | last post by:
I'm doing some analysis that is readily broken up into many independent pieces, on a multicore machine. I thought it would be best to just queue like 1000 of these pieces in the ThreadPool, and...
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...
0
by: UL-Tomten | last post by:
Is the WaitHandle on the IAsyncResult returned from BeginProcessRequest ever used by the HTTP application? The reason I'm asking is that in the MSDN article "How to: Create an Asynchronous HTTP...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.