Skip to content

Commit

Permalink
Fix timer state after event queue was destroyed
Browse files Browse the repository at this point in the history
* Hw tests show state is unaffected by external destruction of the event queue

* Minor race regarding state check fixed (can result in an undestroyable state)
  • Loading branch information
elad335 committed Mar 30, 2019
1 parent 9cd1f08 commit 3307cfa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions rpcs3/Emu/Cell/lv2/sys_timer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "Emu/Memory/vm.h"
#include "Emu/System.h"
#include "Emu/IdManager.h"
Expand Down Expand Up @@ -33,17 +33,17 @@ void lv2_timer_context::operator()()
if (const auto queue = port.lock())
{
queue->send(source, data1, data2, next);
}

if (period)
{
// Set next expiration time and check again (HACK)
expire += period;
continue;
}
if (period)
{
// Set next expiration time and check again (HACK)
expire += period;
continue;
}

// Stop: oneshot or the event port was disconnected (TODO: is it correct?)
state = SYS_TIMER_STATE_STOP;
// Stop after oneshot
state.compare_and_swap_test(SYS_TIMER_STATE_RUN, SYS_TIMER_STATE_STOP);
continue;
}

Expand Down

0 comments on commit 3307cfa

Please sign in to comment.