* Removed UserlandFS shared Locker class. Instead use BLocker in userland and
RecursiveLock in the kernel. * Several adjustments according to UserlandFS header changes. * Re-added reiserfs to image. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29410 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,59 +1,33 @@
|
||||
//
|
||||
// $Id: Locker.h,v 1.1 2002/07/09 12:24:33 ejakowatz Exp $
|
||||
//
|
||||
// This is the Locker interface for OpenBeOS. It has been created to
|
||||
// be source and binary compatible with the BeOS version of Locker.
|
||||
//
|
||||
// bonefish:
|
||||
// * Removed `virtual' from destructor and FBC reserved space.
|
||||
// * Renamed to Locker.
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _USERLAND_FS_LOCKER_H
|
||||
#define _USERLAND_FS_LOCKER_H
|
||||
|
||||
#ifdef _KERNEL_MODE
|
||||
// kernel: use the RecursiveLock class
|
||||
|
||||
|
||||
#ifndef _OPENBEOS_LOCKER_H
|
||||
#define _OPENBEOS_LOCKER_H
|
||||
#include "RecursiveLock.h"
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
namespace UserlandFSUtil {
|
||||
|
||||
class Locker {
|
||||
public:
|
||||
Locker();
|
||||
Locker(const char *name);
|
||||
Locker(bool benaphore_style);
|
||||
Locker(const char *name, bool benaphore_style);
|
||||
|
||||
// The following constructor is not documented in the BeBook
|
||||
// and is only listed here to ensure binary compatibility.
|
||||
// DO NOT USE THIS CONSTRUCTOR!
|
||||
Locker(const char *name, bool benaphore_style, bool);
|
||||
|
||||
~Locker();
|
||||
|
||||
bool Lock(void);
|
||||
status_t LockWithTimeout(bigtime_t timeout);
|
||||
void Unlock(void);
|
||||
|
||||
thread_id LockingThread(void) const;
|
||||
bool IsLocked(void) const;
|
||||
int32 CountLocks(void) const;
|
||||
int32 CountLockRequests(void) const;
|
||||
sem_id Sem(void) const;
|
||||
|
||||
private:
|
||||
void InitLocker(const char *name, bool benaphore_style);
|
||||
bool AcquireLock(bigtime_t timeout, status_t *error);
|
||||
|
||||
int32 fBenaphoreCount;
|
||||
sem_id fSemaphoreID;
|
||||
thread_id fLockOwner;
|
||||
int32 fRecursiveCount;
|
||||
typedef RecursiveLock Locker;
|
||||
};
|
||||
|
||||
} // namespace UserlandFSUtil
|
||||
|
||||
#else
|
||||
// userland: use the BLocker class
|
||||
|
||||
#include <Locker.h>
|
||||
|
||||
namespace UserlandFSUtil {
|
||||
typedef BLocker Locker;
|
||||
};
|
||||
|
||||
#endif // kernel/userland
|
||||
|
||||
using UserlandFSUtil::Locker;
|
||||
|
||||
#endif // _OPENBEOS_LOCKER_H
|
||||
#endif // _USERLAND_FS_LOCKER_H
|
||||
|
||||
Reference in New Issue
Block a user