473,507 Members | 4,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Monitor.Wait vs Thread.Sleep

DT
Hi All,

I understand the Thread.Sleep method is a very effcient wait state.
Can the same be said for the Monitor.Wait method?

Many Thanks

DT
Jul 21 '05 #1
2 2881
They're used for two different things. In Win32 most blocking waits are
efficient as long as you're letting the OS do the waiting, and the .NET
wrappers are no exception.
--
Klaus H. Probst, MVP
http://www.vbbox.com/
"DT" <dt@nospam.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Hi All,

I understand the Thread.Sleep method is a very effcient wait state. Can the same be said for the Monitor.Wait method?

Many Thanks

DT

Jul 21 '05 #2
DT
Thanks for the reply Klaus, I know they're different, I'm using the
Monitor.Wait method to wait for a period of time or when I want to signal
it. I just wanted to know there was any problems in doing this.

thanks

"DT" <dt@nospam.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Hi All,

I understand the Thread.Sleep method is a very effcient wait state.
Can the same be said for the Monitor.Wait method?

Many Thanks

DT

Jul 21 '05 #3

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

Similar topics

4
20720
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...
5
3832
by: bughunter | last post by:
Hi, Consider this code: ---- Monitor.Pulse(oLock); Monitor.Exit(oLock); ---- If a thread was waiting on oLock then will the current thread
11
2912
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
2668
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...
4
560
by: DT | last post by:
Hi All, I understand the Thread.Sleep method is a very effcient wait state. Can the same be said for the Monitor.Wait method? Many Thanks DT
0
2449
by: Chris Chilvers | last post by:
I've found the docs to be rather scant on exactly what the second parameter to WaitHandle.WaitOne(Int32, Boolean) was for. The one named exitContext so I started playing with the synchronize...
12
5237
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
2477
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...
13
2656
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
7105
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
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
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...
1
7023
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
5617
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,...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.