Click here to Skip to main content
13,199,852 members (62,841 online)
Click here to Skip to main content

Stats

44.9K views
582 downloads
25 bookmarked
Posted 20 Jan 2009

Testing reader/writer locks

, 20 Jan 2009
This article describes testing the results of reader/writer locks on Windows XP/Vista Uniprocessor and Multi-core PCs.
#pragma once

class SlimRWLock
{
public:
	SlimRWLock()
	{
		::InitializeSRWLock(&srwLock_);
	}

	void acquireLockShared() 
	{
		::AcquireSRWLockShared(&srwLock_);
	}

	void acquireLockExclusive()
	{
		::AcquireSRWLockExclusive(&srwLock_);
	}

	void releaseLockShared()
	{
		::ReleaseSRWLockShared(&srwLock_);
	}

	void releaseLockExclusive()
	{
		::ReleaseSRWLockExclusive(&srwLock_);
	}

	DWORD numberReaderRacesLost() const
	{
		return 0;
	}

	DWORD numberReaderWakeups() const
	{
		return 0;
	}

	LONGLONG locked_acquiringLockExclusive(void) const
	{
		return 0L;
	}
	LONGLONG locked_acquiringLockShared(void) const
	{
		return 0L;
	}

private:
	SRWLOCK srwLock_;
};

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Valery Grebnev
Software Developer
Canada Canada
No Biography provided

You may also be interested in...

Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171020.1 | Last Updated 21 Jan 2009
Article Copyright 2009 by Valery Grebnev
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid