Forgot to remove AccessHelper.h. :)
The manager will take care of all accessing threads. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4401 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,48 +0,0 @@
|
|||||||
//----------------------------------------------------------------------
|
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
|
||||||
// by the OpenBeOS license.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2003 Waldemar Kornewald, [email protected]
|
|
||||||
//---------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
|
||||||
* AccessHelper.h
|
|
||||||
*
|
|
||||||
* The AccessHelper class automatically increases the given variable by
|
|
||||||
* one on construction and decreases it by one on destruction. If a NULL
|
|
||||||
* pointer is given, it will do nothing.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _ACCESS_HELPER__H
|
|
||||||
#define _ACCESS_HELPER__H
|
|
||||||
|
|
||||||
#include <OS.h>
|
|
||||||
#include <SupportDefs.h>
|
|
||||||
|
|
||||||
|
|
||||||
class AccessHelper {
|
|
||||||
private:
|
|
||||||
// copies are not allowed!
|
|
||||||
AccessHelper(const AccessHelper& copy);
|
|
||||||
AccessHelper& operator= (const AccessHelper& copy);
|
|
||||||
|
|
||||||
public:
|
|
||||||
AccessHelper(vint32 *access) : fAccess(access)
|
|
||||||
{
|
|
||||||
if(fAccess)
|
|
||||||
atomic_add(fAccess, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
~AccessHelper()
|
|
||||||
{
|
|
||||||
if(fAccess)
|
|
||||||
atomic_add(fAccess, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
vint32 *fAccess;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user