kernel: Rework ConditionVariableEntry destruction.
It is no longer an error to destroy a ConditionVariableEntry that is still attached to a ConditionVariable; it will now be implicitly detached in that case. This makes ConditionVariableEntrys much eaiser to use from an API standpoint. Change-Id: I03c676d3a198aa885de733d3e1729b15f80de031 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2301 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
1c9c772967
commit
1728b8c777
@@ -23,10 +23,8 @@ struct ConditionVariable;
|
||||
struct ConditionVariableEntry
|
||||
: DoublyLinkedListLinkImpl<ConditionVariableEntry> {
|
||||
public:
|
||||
#if KDEBUG
|
||||
inline ConditionVariableEntry();
|
||||
inline ~ConditionVariableEntry();
|
||||
#endif
|
||||
ConditionVariableEntry();
|
||||
~ConditionVariableEntry();
|
||||
|
||||
bool Add(const void* object);
|
||||
status_t Wait(uint32 flags = 0, bigtime_t timeout = 0);
|
||||
@@ -38,7 +36,8 @@ public:
|
||||
inline ConditionVariable* Variable() const { return fVariable; }
|
||||
|
||||
private:
|
||||
inline void AddToLockedVariable(ConditionVariable* variable);
|
||||
inline void _AddToLockedVariable(ConditionVariable* variable);
|
||||
void _RemoveFromVariable();
|
||||
|
||||
private:
|
||||
spinlock fLock;
|
||||
@@ -100,26 +99,6 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
#if KDEBUG
|
||||
|
||||
inline
|
||||
ConditionVariableEntry::ConditionVariableEntry()
|
||||
: fVariable(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
ConditionVariableEntry::~ConditionVariableEntry()
|
||||
{
|
||||
if (fVariable != NULL) {
|
||||
panic("Destroying condition variable entry %p, but it's still "
|
||||
"attached to variable %p\n", this, fVariable);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
inline void
|
||||
ConditionVariable::NotifyOne(status_t result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user