kernel/DPC: allow adding callback to queue if already added (will do nothing)

It caused DPC list corruption when adding already added callback before
this change.

Change-Id: I81928795f91c6cf46fe3be4a8a042e07b9203161
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7363
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
X512 2023-09-07 03:42:05 +09:00 committed by waddlesplash
parent 123fa38638
commit e925863d95

View File

@ -166,6 +166,9 @@ DPCQueue::Add(DPCCallback* callback)
if (_IsClosed())
return B_NOT_INITIALIZED;
if (callback->fInQueue != NULL)
return EALREADY;
bool wasEmpty = fCallbacks.IsEmpty();
fCallbacks.Add(callback);
callback->fInQueue = this;