Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
eab35c82
There was an error fetching the commit references. Please try again later.
Commit
eab35c82
authored
6 years ago
by
B3n30
Browse files
Options
Downloads
Patches
Plain Diff
Core::CoreTiming: add UnscheduleEventThreadsafe
parent
e67630b5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/core_timing.cpp
+10
-0
10 additions, 0 deletions
src/core/core_timing.cpp
src/core/core_timing.h
+1
-0
1 addition, 0 deletions
src/core/core_timing.h
src/core/hle/kernel/thread.cpp
+1
-1
1 addition, 1 deletion
src/core/hle/kernel/thread.cpp
with
12 additions
and
1 deletion
src/core/core_timing.cpp
+
10
−
0
View file @
eab35c82
...
...
@@ -56,6 +56,9 @@ static u64 event_fifo_id;
// to the event_queue by the emu thread
static
Common
::
MPSCQueue
<
Event
,
false
>
ts_queue
;
// the queue for unscheduling the events from other threads threadsafe
static
Common
::
MPSCQueue
<
std
::
pair
<
const
EventType
*
,
u64
>
,
false
>
unschedule_queue
;
constexpr
int
MAX_SLICE_LENGTH
=
20000
;
static
s64
idled_cycles
;
...
...
@@ -158,6 +161,10 @@ void UnscheduleEvent(const EventType* event_type, u64 userdata) {
}
}
void
UnscheduleEventThreadsafe
(
const
EventType
*
event_type
,
u64
userdata
)
{
unschedule_queue
.
Push
(
std
::
make_pair
(
event_type
,
userdata
));
}
void
RemoveEvent
(
const
EventType
*
event_type
)
{
auto
itr
=
std
::
remove_if
(
event_queue
.
begin
(),
event_queue
.
end
(),
[
&
](
const
Event
&
e
)
{
return
e
.
type
==
event_type
;
});
...
...
@@ -194,6 +201,9 @@ void MoveEvents() {
void
Advance
()
{
MoveEvents
();
for
(
std
::
pair
<
const
EventType
*
,
u64
>
ev
;
unschedule_queue
.
Pop
(
ev
);)
{
UnscheduleEvent
(
ev
.
first
,
ev
.
second
);
}
int
cycles_executed
=
slice_length
-
downcount
;
global_timer
+=
cycles_executed
;
...
...
This diff is collapsed.
Click to expand it.
src/core/core_timing.h
+
1
−
0
View file @
eab35c82
...
...
@@ -65,6 +65,7 @@ void ScheduleEvent(s64 cycles_into_future, const EventType* event_type, u64 user
void
ScheduleEventThreadsafe
(
s64
cycles_into_future
,
const
EventType
*
event_type
,
u64
userdata
);
void
UnscheduleEvent
(
const
EventType
*
event_type
,
u64
userdata
);
void
UnscheduleEventThreadsafe
(
const
EventType
*
event_type
,
u64
userdata
);
/// We only permit one event of each type in the queue at a time.
void
RemoveEvent
(
const
EventType
*
event_type
);
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/kernel/thread.cpp
+
1
−
1
View file @
eab35c82
...
...
@@ -167,7 +167,7 @@ void Thread::WakeAfterDelay(s64 nanoseconds) {
}
void
Thread
::
CancelWakeupTimer
()
{
CoreTiming
::
UnscheduleEvent
(
ThreadWakeupEventType
,
callback_handle
);
CoreTiming
::
UnscheduleEvent
Threadsafe
(
ThreadWakeupEventType
,
callback_handle
);
}
static
boost
::
optional
<
s32
>
GetNextProcessorId
(
u64
mask
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment