The ReadWriteLock class now has an Initialize() method to initialize the
object after creation. This enables the Inode constructor to set a better name for the lock. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3363 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
24d6529a93
commit
1d9fd63d3a
@ -149,15 +149,17 @@ class Locker {
|
||||
#ifdef FAST_LOCK
|
||||
class ReadWriteLock {
|
||||
public:
|
||||
ReadWriteLock(const char *name = "bfs r/w lock")
|
||||
ReadWriteLock(const char *name)
|
||||
:
|
||||
fWriteLock()
|
||||
{
|
||||
Initialize(name);
|
||||
}
|
||||
|
||||
ReadWriteLock()
|
||||
:
|
||||
fSemaphore(create_sem(0, name)),
|
||||
fCount(MAX_READERS),
|
||||
fWriteLock()
|
||||
{
|
||||
#ifndef USER
|
||||
set_sem_owner(fSemaphore, B_SYSTEM_TEAM);
|
||||
#endif
|
||||
}
|
||||
|
||||
~ReadWriteLock()
|
||||
@ -165,6 +167,16 @@ class ReadWriteLock {
|
||||
delete_sem(fSemaphore);
|
||||
}
|
||||
|
||||
status_t Initialize(const char *name = "bfs r/w lock")
|
||||
{
|
||||
fSemaphore = create_sem(0, name);
|
||||
fCount = MAX_READERS;
|
||||
#ifndef USER
|
||||
set_sem_owner(fSemaphore, B_SYSTEM_TEAM);
|
||||
#endif
|
||||
return fSemaphore;
|
||||
}
|
||||
|
||||
status_t InitCheck()
|
||||
{
|
||||
if (fSemaphore < B_OK)
|
||||
@ -226,13 +238,13 @@ class ReadWriteLock {
|
||||
#else // FAST_LOCK
|
||||
class ReadWriteLock {
|
||||
public:
|
||||
ReadWriteLock(const char *name = "bfs r/w lock")
|
||||
:
|
||||
fSemaphore(create_sem(MAX_READERS, name))
|
||||
ReadWriteLock(const char *name)
|
||||
{
|
||||
Initialize(name);
|
||||
}
|
||||
|
||||
ReadWriteLock()
|
||||
{
|
||||
#ifndef USER
|
||||
set_sem_owner(fSemaphore, B_SYSTEM_TEAM);
|
||||
#endif
|
||||
}
|
||||
|
||||
~ReadWriteLock()
|
||||
@ -240,6 +252,15 @@ class ReadWriteLock {
|
||||
delete_sem(fSemaphore);
|
||||
}
|
||||
|
||||
status_t Initialize(const char *name = "bfs r/w lock")
|
||||
{
|
||||
fSemaphore = create_sem(MAX_READERS, name);
|
||||
#ifndef USER
|
||||
set_sem_owner(fSemaphore, B_SYSTEM_TEAM);
|
||||
#endif
|
||||
return fSemaphore;
|
||||
}
|
||||
|
||||
status_t InitCheck()
|
||||
{
|
||||
if (fSemaphore < B_OK)
|
||||
|
Loading…
Reference in New Issue
Block a user