473,507 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

threading WaitOne()

I have this kind of construct:

Somewhere in thread 1 -------------------------------------------------

SyncLock _objTxRxSync
'code to set some values in _objTxRxSync object
If _objSignal.WaitOne(1000, True) Then
'do stuff when other thread signals
Else
'do stuff when timeout
End If
End SyncLock

Somewhere in thread 2 -------------------------------------------------

SyncLock _objTxRxSync
'code to set some values in _objTxRxSync object

_objSignal.Set()
End SyncLock

--------------------------------------------------------------------------

The problem is that thread 1 never gives up the lock on _objTxRxSync during
the 1000ms wait for thread 2 to access. The documentation states that if the
second parameter for the WaitOne method is set to True, the waiting threat
(thread 1) should give up the lock of the sync context and reaquire it when
signaled by thread 2. Why does this not work? I am using .NET v2.0 latest
release. Is this a bug?
Thanks
Perry

Nov 21 '05 #1
0 903

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

Similar topics

77
5208
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
4
2481
by: Perecli Manole | last post by:
I have a background worker thread that receives queued work items and processes them. How do I make this background thread go in a sleep state while the queue is empty and then wake back up as soon...
17
1424
by: One Handed Man \( OHM - Terry Burns \) | last post by:
Assumes a Form with a Panel on it., Does the Mutex have to be within the address of a thread start address ? Cheers - OHM '----------- *************** ---------------- Private...
4
1446
by: MS | last post by:
Hi. I'm new to developing and c#. I'm developing a tool that allows a user to select a directory with specially formatted files. The tool then iterates through the list of files in the directory...
13
1195
by: **Developer** | last post by:
I have a simple need that I can't seem to locate the answer to in the docs. Most examples show how a worker thread can pass data back to the thread that created it. I need to do the opposite....
0
1167
by: archana | last post by:
Hi all, I have some confusion related to threading and autoresetevent. I have 5 threads running for each i have autoresetevent which i am setting through thread procedure. On each of event...
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...
6
1307
by: MobileBoy36 | last post by:
Hi All, I want to make a LogFile class that is thread safe. I use a Mutex for it. But the behavior of the class is not that normal. In a c# guide I read you can achieve it by simply using...
7
2351
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has...
4
14378
by: Lauren Quantrell | last post by:
I have just put together a vb.net app and now need to provide it to users. This application needs to run the code in a sub every 60 seconds from a Windows Service application. I have the...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
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...
1
7031
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
7485
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
5623
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
5042
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
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.