* 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:
Axel Dörfler
2011-10-29 21:17:59 +00:00
parent 78fcc847a2
commit ef88976995
5 changed files with 28 additions and 3 deletions
+2
View File
@@ -41,6 +41,8 @@ public:
BLooper* LooperForName(const char* name);
BLooper* LooperForPort(port_id port);
void InitAfterFork();
private:
struct LooperData {
LooperData();
+2
View File
@@ -51,6 +51,8 @@ public:
status_t AcquireHandlerTarget(int32 token,
BDirectMessageTarget** _target);
void InitAfterFork();
private:
struct token_info {
int16 type;
+5 -1
View File
@@ -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"));
}
+9 -1
View File
@@ -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)
{
+10 -1
View File
@@ -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