473,479 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

readerwriterlock - RestoreLock

Is there any difference between:
- ReleaseLock and RestoreLock and
- simply releasing the Lock with ReleaseReaderLock or ReleaseWriterLockand
acquire the lock again with AcquireReaderLock or AcquireWriterLock?

Thank you
Sincerely
Lore
Nov 24 '05 #1
3 1023
Hello Lore ,

see

ReleaseLock
http://msdn.microsoft.com/library/de...elocktopic.asp

ReleaseReaderLock
http://msdn.microsoft.com/library/de...rlocktopic.asp

in short the ReleaseLock releases the reader lock or writer lock, regardless
of the recursive lock count.
and the ReleaseReaderLock decrements the lock count. When the count reaches
zero, the lock is released. if there is no lock an error is raised
so yes there is a difference

hth

Michel Posseth [MCP]
"Lore Leunoeg" <lo*********@gmx.net> wrote in message
news:dm**********@news01.versatel.de...
Is there any difference between:
- ReleaseLock and RestoreLock and
- simply releasing the Lock with ReleaseReaderLock or ReleaseWriterLockand
acquire the lock again with AcquireReaderLock or AcquireWriterLock?

Thank you
Sincerely
Lore

Nov 24 '05 #2
Thank you for the links. But -mmh - what exactly means "recursive lock
count"? Why "recursive"? And is the lock count the ReleaseReaderLock
decrements also recursive?

Thank you again
Sincerely
Lore

"m.posseth" <mi*****@nohausystems.nl> schrieb im Newsbeitrag
news:OA**************@TK2MSFTNGP11.phx.gbl...
Hello Lore ,

see

ReleaseLock
http://msdn.microsoft.com/library/de...elocktopic.asp
ReleaseReaderLock
http://msdn.microsoft.com/library/de...rlocktopic.asp
in short the ReleaseLock releases the reader lock or writer lock, regardless of the recursive lock count.
and the ReleaseReaderLock decrements the lock count. When the count reaches zero, the lock is released. if there is no lock an error is raised
so yes there is a difference

hth

Michel Posseth [MCP]
"Lore Leunoeg" <lo*********@gmx.net> wrote in message
news:dm**********@news01.versatel.de...
Is there any difference between:
- ReleaseLock and RestoreLock and
- simply releasing the Lock with ReleaseReaderLock or ReleaseWriterLockand acquire the lock again with AcquireReaderLock or AcquireWriterLock?

Thank you
Sincerely
Lore


Nov 24 '05 #3
See:

http://msdn.microsoft.com/library/de...LockTopic1.asp

You can call AcquireReaderLock multiple times aka "recursively" ergo you
need to call ReleaseReaderLock the same number of times, the same with
WriterLock.

Each time you call AcquireReaderLock the lock count is incremented by one,
each time you call ReleaseReaderLock the lock counted is decremented by one.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Lore Leunoeg" <lo*********@gmx.net> wrote in message
news:dm**********@news01.versatel.de...
| Thank you for the links. But -mmh - what exactly means "recursive lock
| count"? Why "recursive"? And is the lock count the ReleaseReaderLock
| decrements also recursive?
|
| Thank you again
| Sincerely
| Lore
|
| "m.posseth" <mi*****@nohausystems.nl> schrieb im Newsbeitrag
| news:OA**************@TK2MSFTNGP11.phx.gbl...
| > Hello Lore ,
| >
| > see
| >
| > ReleaseLock
| >
|
http://msdn.microsoft.com/library/de...elocktopic.asp
| >
| > ReleaseReaderLock
| >
|
http://msdn.microsoft.com/library/de...rlocktopic.asp
| >
| >
| >
| > in short the ReleaseLock releases the reader lock or writer lock,
| regardless
| > of the recursive lock count.
| > and the ReleaseReaderLock decrements the lock count. When the count
| reaches
| > zero, the lock is released. if there is no lock an error is raised
| >
| >
| > so yes there is a difference
| >
| > hth
| >
| > Michel Posseth [MCP]
| >
| >
| > "Lore Leunoeg" <lo*********@gmx.net> wrote in message
| > news:dm**********@news01.versatel.de...
| > > Is there any difference between:
| > > - ReleaseLock and RestoreLock and
| > > - simply releasing the Lock with ReleaseReaderLock or
| ReleaseWriterLockand
| > > acquire the lock again with AcquireReaderLock or AcquireWriterLock?
| > >
| > > Thank you
| > > Sincerely
| > > Lore
| > >
| > >
| >
| >
|
|
Nov 28 '05 #4

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

Similar topics

2
3279
by: pokémon | last post by:
Question: Is this thread-safe: ReaderWriterLock rwl = new ReaderWriterLock(); Queue q = new Queue(); public int GetCount() { int val = 0; try {
2
1703
by: Tryion | last post by:
Hi, I'd like to know if it's possible/responsible to use the ReaderWriterLock class (RWL) in a class without declaring it as "static". The example in the SDK does not use a static RWL. However,...
3
4004
by: J.Marsch | last post by:
Issue: I have 3 threads, syncing with a ReaderWriterLock (in "real life", there will be more). Thread 1 (there could be any number of these) Gets a read lock with infinite timeout. It runs in...
0
1945
by: Qingdong Z. | last post by:
I have a public shared DateTime type variable called . There are multiple work threads updating this variable to current time (Now). Normally, the DateTime variable is updated 10-100 times per...
6
2138
by: Itay | last post by:
Hi , Is there a way to lock several ReaderWriterLock in an atomic manner? I have numerous amount of ReaderWriterLock objects and I need to lock some of them for reading only, is there a way...
4
5485
by: Anders Borum | last post by:
Hello! I am working on improving my threading skills and came across a question. When working with the ReaderWriterLock class, I am getting an unhandled exception if I acquire a WriterLock with...
7
2752
by: Julie | last post by:
According to the documentation for the Acquire methods on the ReaderWriterLock class: -1 Infinite. 0 No time-out. > 0 The number of milliseconds to wait. ...
1
1445
by: fm | last post by:
I have a public shared property in global.asax. When the variable of the property is not instantiated (first page to call it, cache empties, etc.) the code then loads the variable from source...
16
3430
by: akantrowitz | last post by:
In csharp, what is the correct locking around reading and writing into a hashtable. Note that the reader is not looping through the keys, simply reading an item out with a specific key: If i...
0
7027
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
7067
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
5312
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
4757
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
4463
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
2980
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...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
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
555
muto222
php
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.