readerwriterlock - RestoreLock

  • Thread starter Thread starter Lore Leunoeg
  • Start date Start date
L

Lore Leunoeg

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
 
Hello Lore ,

see

ReleaseLock
http://msdn.microsoft.com/library/d...dingreaderwriterlockclassreleaselocktopic.asp

ReleaseReaderLock
http://msdn.microsoft.com/library/d...aderwriterlockclassreleasereaderlocktopic.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]
 
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 said:
Hello Lore ,

see

ReleaseLock
http://msdn.microsoft.com/library/d...dingreaderwriterlockclassreleaselocktopic.asp
ReleaseReaderLock
http://msdn.microsoft.com/library/d...aderwriterlockclassreleasereaderlocktopic.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 said:
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
 
See:

http://msdn.microsoft.com/library/d...derWriterLockClassAcquireReaderLockTopic1.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


| 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
|
| | > Hello Lore ,
| >
| > see
| >
| > ReleaseLock
| >
|
http://msdn.microsoft.com/library/d...dingreaderwriterlockclassreleaselocktopic.asp
| >
| > ReleaseReaderLock
| >
|
http://msdn.microsoft.com/library/d...aderwriterlockclassreleasereaderlocktopic.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]
| >
| >
| > | > > 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
| > >
| > >
| >
| >
|
|
 
Back
Top