* Reinitialize global locks after a fork (at least those in the Application
Kit). * This should fix #5668. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42982 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -41,6 +41,8 @@ public:
|
||||
BLooper* LooperForName(const char* name);
|
||||
BLooper* LooperForPort(port_id port);
|
||||
|
||||
void InitAfterFork();
|
||||
|
||||
private:
|
||||
struct LooperData {
|
||||
LooperData();
|
||||
|
||||
@@ -51,6 +51,8 @@ public:
|
||||
status_t AcquireHandlerTarget(int32 token,
|
||||
BDirectMessageTarget** _target);
|
||||
|
||||
void InitAfterFork();
|
||||
|
||||
private:
|
||||
struct token_info {
|
||||
int16 type;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2009, Haiku.
|
||||
* Copyright 2001-2011, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -12,8 +12,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <LooperList.h>
|
||||
#include <MessagePrivate.h>
|
||||
#include <RosterPrivate.h>
|
||||
#include <TokenSpace.h>
|
||||
|
||||
|
||||
// debugging
|
||||
@@ -28,6 +30,8 @@ initialize_forked_child()
|
||||
DBG(OUT("initialize_forked_child()\n"));
|
||||
|
||||
BMessage::Private::StaticReInitForkedChild();
|
||||
BPrivate::gLooperList.InitAfterFork();
|
||||
BPrivate::gDefaultTokens.InitAfterFork();
|
||||
|
||||
DBG(OUT("initialize_forked_child() done\n"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2010, Haiku.
|
||||
* Copyright 2001-2011, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -187,6 +187,14 @@ BLooperList::LooperForPort(port_id port)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BLooperList::InitAfterFork()
|
||||
{
|
||||
// We need to reinitialize the locker to get a new semaphore
|
||||
new (&fLock) BLocker("BLooperList lock");
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BLooperList::EmptySlotPred(LooperData& data)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2009, Haiku.
|
||||
* Copyright 2001-2011, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -169,4 +169,13 @@ BTokenSpace::AcquireHandlerTarget(int32 token, BDirectMessageTarget** _target)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BTokenSpace::InitAfterFork()
|
||||
{
|
||||
// We need to reinitialize the locker to get a new semaphore
|
||||
new (this) BTokenSpace();
|
||||
}
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
Reference in New Issue
Block a user