* mutex_lock() and recursive_lock_lock() now return a status_t and report failure.

* recursive_lock_unlock() now returns a void to mirror it's counterpart better;
  use recursive_lock_get_recursion() if you're interested in the lock depth.
* switch_sem(), and release_sem() now don't do anything anymore in kernel startup
  mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20099 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-02-07 14:07:31 +00:00
parent d5d570384c
commit aa547f5fbb
5 changed files with 70 additions and 64 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2004, Axel Dörfler, [email protected].
* Copyright 2002-2007, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -52,13 +52,13 @@ extern "C" {
extern status_t recursive_lock_init(recursive_lock *lock, const char *name);
extern void recursive_lock_destroy(recursive_lock *lock);
extern bool recursive_lock_lock(recursive_lock *lock);
extern bool recursive_lock_unlock(recursive_lock *lock);
extern int recursive_lock_get_recursion(recursive_lock *lock);
extern status_t recursive_lock_lock(recursive_lock *lock);
extern void recursive_lock_unlock(recursive_lock *lock);
extern int32 recursive_lock_get_recursion(recursive_lock *lock);
extern status_t mutex_init(mutex *m, const char *name);
extern void mutex_destroy(mutex *m);
extern void mutex_lock(mutex *m);
extern status_t mutex_lock(mutex *m);
extern void mutex_unlock(mutex *m);
extern status_t benaphore_init(benaphore *ben, const char *name);
+6 -7
View File
@@ -1,13 +1,14 @@
/*
* Copyright 2005, Ingo Weinhold, [email protected]. All rights reserved.
/*
* Copyright 2005-2007, Ingo Weinhold, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_UTIL_AUTO_LOCKER_H
#define KERNEL_UTIL_AUTO_LOCKER_H
#include <lock.h>
namespace BPrivate {
// AutoLockerStandardLocking
@@ -165,8 +166,7 @@ class MutexLocking {
public:
inline bool Lock(mutex *lockable)
{
mutex_lock(lockable);
return true;
return mutex_lock(lockable) == B_OK;
}
inline void Unlock(mutex *lockable)
@@ -183,8 +183,7 @@ class RecursiveLockLocking {
public:
inline bool Lock(recursive_lock *lockable)
{
recursive_lock_lock(lockable);
return true;
return recursive_lock_lock(lockable) == B_OK;
}
inline void Unlock(recursive_lock *lockable)