Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams. * We now discriminate correctly between process and thread signals. Signal handlers have been moved to teams. Fixes #5679. * Implemented real-time signal support, including signal queuing, SA_SIGINFO support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition of the real-time signal range. Closes #1935 and #2695. * Gave SIGBUS a separate signal number. Fixes #6704. * Implemented <time.h> clock and timer support, and fixed/completed alarm() and [set]itimer(). Closes #5682. * Implemented support for thread cancellation. Closes #5686. * Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554. * Lots over smaller more or less related changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2008, Ingo Weinhold, [email protected].de.
|
||||
* Copyright 2007-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@@ -134,14 +134,15 @@ ConditionVariableEntry::Wait(uint32 flags, bigtime_t timeout)
|
||||
|
||||
conditionLocker.Unlock();
|
||||
|
||||
SpinLocker threadLocker(gThreadSpinlock);
|
||||
SpinLocker schedulerLocker(gSchedulerLock);
|
||||
|
||||
status_t error;
|
||||
if ((flags & (B_RELATIVE_TIMEOUT | B_ABSOLUTE_TIMEOUT)) != 0)
|
||||
error = thread_block_with_timeout_locked(flags, timeout);
|
||||
else
|
||||
error = thread_block_locked(thread_get_current_thread());
|
||||
threadLocker.Unlock();
|
||||
|
||||
schedulerLocker.Unlock();
|
||||
|
||||
conditionLocker.Lock();
|
||||
|
||||
@@ -220,12 +221,12 @@ ConditionVariable::Publish(const void* object, const char* objectType)
|
||||
|
||||
|
||||
void
|
||||
ConditionVariable::Unpublish(bool threadsLocked)
|
||||
ConditionVariable::Unpublish(bool schedulerLocked)
|
||||
{
|
||||
ASSERT(fObject != NULL);
|
||||
|
||||
InterruptsLocker _;
|
||||
SpinLocker threadLocker(threadsLocked ? NULL : &gThreadSpinlock);
|
||||
SpinLocker schedulerLocker(schedulerLocked ? NULL : &gSchedulerLock);
|
||||
SpinLocker locker(sConditionVariablesLock);
|
||||
|
||||
#if KDEBUG
|
||||
@@ -262,7 +263,7 @@ ConditionVariable::Wait(uint32 flags, bigtime_t timeout)
|
||||
|
||||
|
||||
/*static*/ void
|
||||
ConditionVariable::NotifyOne(const void* object, bool threadsLocked,
|
||||
ConditionVariable::NotifyOne(const void* object, bool schedulerLocked,
|
||||
status_t result)
|
||||
{
|
||||
InterruptsSpinLocker locker(sConditionVariablesLock);
|
||||
@@ -271,13 +272,13 @@ ConditionVariable::NotifyOne(const void* object, bool threadsLocked,
|
||||
if (variable == NULL)
|
||||
return;
|
||||
|
||||
variable->NotifyOne(threadsLocked, result);
|
||||
variable->NotifyOne(schedulerLocked, result);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ void
|
||||
ConditionVariable::NotifyAll(const void* object,
|
||||
bool threadsLocked, status_t result)
|
||||
ConditionVariable::NotifyAll(const void* object, bool schedulerLocked,
|
||||
status_t result)
|
||||
{
|
||||
InterruptsSpinLocker locker(sConditionVariablesLock);
|
||||
ConditionVariable* variable = sConditionVariableHash.Lookup(object);
|
||||
@@ -285,7 +286,7 @@ ConditionVariable::NotifyAll(const void* object,
|
||||
if (variable == NULL)
|
||||
return;
|
||||
|
||||
variable->NotifyAll(threadsLocked, result);
|
||||
variable->NotifyAll(schedulerLocked, result);
|
||||
}
|
||||
|
||||
|
||||
@@ -321,10 +322,10 @@ ConditionVariable::Dump() const
|
||||
|
||||
|
||||
void
|
||||
ConditionVariable::_Notify(bool all, bool threadsLocked, status_t result)
|
||||
ConditionVariable::_Notify(bool all, bool schedulerLocked, status_t result)
|
||||
{
|
||||
InterruptsLocker _;
|
||||
SpinLocker threadLocker(threadsLocked ? NULL : &gThreadSpinlock);
|
||||
SpinLocker schedulerLocker(schedulerLocked ? NULL : &gSchedulerLock);
|
||||
SpinLocker locker(sConditionVariablesLock);
|
||||
|
||||
if (!fEntries.IsEmpty()) {
|
||||
@@ -339,7 +340,7 @@ ConditionVariable::_Notify(bool all, bool threadsLocked, status_t result)
|
||||
|
||||
|
||||
/*! Called with interrupts disabled and the condition variable spinlock and
|
||||
thread lock held.
|
||||
scheduler lock held.
|
||||
*/
|
||||
void
|
||||
ConditionVariable::_NotifyLocked(bool all, status_t result)
|
||||
|
||||
Reference in New Issue
Block a user