Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Tagged as

Shared and Exclusive lock control

, 31 Aug 2004
C++ class for shared and exclusive lock control.
locker.zip
sourcecode
locker
Locker.dsp
Locker.dsw
TLocker.dsp
release
TLocker.exe
tlockter_readme.txt

This file describes the TLOCKER test program.

TLOCKER.EXE is a Win32 console application that exercises the Locker class.

Double-click on it, and watch the execution.
The test log is placed in TLOCKER.TXT in the current directory.
A progress commentary is displayed on the console.

Test description:

Group 1:

Tests all Locker functions for LNAME > 64 bytes.
    All 4 tests should return RC=-1.

Group 2:

Runs for 20 seconds.

There are 2 "data bases"  A & B
Their ADDRESSes are used as the lock name.

6 threads are started, passing a structure containing:
   Locker class
   Thread number
   Lock type (FALSE=read only, TRUE=update)
   Pointer to Data Base address
     (Even numbered threads get B, Odd numbered threads get data base A)

Threads 2 and 5 update their data base using exclusive locks.  The data base
    value field is incremented on each pass.
Threads 0, 1, 3, and 4 display the current data base value.

There is a 10ms timer delay on all threads except for ODD/update threads, which wait for
   500ms.  This unbalances the execution against the two data bases, making their respective
   values diverge.  This simulates a longer code path for one data base update.

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Charles Bargar
Software Developer (Senior)
United States United States
Application and systems programmer since 1972.
Mostly mainframe programming - Assembler, PL/X.
Products: IBM: DFSMSHSM, Candle Corp: Omegamon (IMS and MVS), PKWARE: SecureZIP
 

Dabble in Windows and Linux at home - C++ and Intel Assembler.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 1 Sep 2004
Article Copyright 2004 by Charles Bargar
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid