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
b5d1e447
There was an error fetching the commit references. Please try again later.
Commit
b5d1e447
authored
5 years ago
by
Fernando Sahmkow
Committed by
FernandoS27
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add PrepareReschedule where required.
parent
b8b7ebce
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/hle/kernel/address_arbiter.cpp
+12
-16
12 additions, 16 deletions
src/core/hle/kernel/address_arbiter.cpp
src/core/hle/kernel/mutex.cpp
+2
-0
2 additions, 0 deletions
src/core/hle/kernel/mutex.cpp
src/core/hle/kernel/wait_object.cpp
+4
-0
4 additions, 0 deletions
src/core/hle/kernel/wait_object.cpp
with
18 additions
and
16 deletions
src/core/hle/kernel/address_arbiter.cpp
+
12
−
16
View file @
b5d1e447
...
...
@@ -22,6 +22,8 @@ namespace Kernel {
namespace
{
// Wake up num_to_wake (or all) threads in a vector.
void
WakeThreads
(
const
std
::
vector
<
SharedPtr
<
Thread
>>&
waiting_threads
,
s32
num_to_wake
)
{
auto
&
system
=
Core
::
System
::
GetInstance
();
// Only process up to 'target' threads, unless 'target' is <= 0, in which case process
// them all.
std
::
size_t
last
=
waiting_threads
.
size
();
...
...
@@ -35,6 +37,8 @@ void WakeThreads(const std::vector<SharedPtr<Thread>>& waiting_threads, s32 num_
waiting_threads
[
i
]
->
SetWaitSynchronizationResult
(
RESULT_SUCCESS
);
waiting_threads
[
i
]
->
SetArbiterWaitAddress
(
0
);
waiting_threads
[
i
]
->
ResumeFromWait
();
if
(
waiting_threads
[
i
]
->
GetProcessorID
()
>=
0
)
system
.
CpuCore
(
waiting_threads
[
i
]
->
GetProcessorID
()).
PrepareReschedule
();
}
}
}
// Anonymous namespace
...
...
@@ -174,25 +178,17 @@ ResultCode AddressArbiter::WaitForAddressImpl(VAddr address, s64 timeout) {
}
std
::
vector
<
SharedPtr
<
Thread
>>
AddressArbiter
::
GetThreadsWaitingOnAddress
(
VAddr
address
)
const
{
const
auto
RetrieveWaitingThreads
=
[
this
](
std
::
size_t
core_index
,
std
::
vector
<
SharedPtr
<
Thread
>>&
waiting_threads
,
VAddr
arb_addr
)
{
const
auto
&
scheduler
=
system
.
Scheduler
(
core_index
);
const
auto
&
thread_list
=
scheduler
.
GetThreadList
();
for
(
const
auto
&
thread
:
thread_list
)
{
if
(
thread
->
GetArbiterWaitAddress
()
==
arb_addr
)
{
waiting_threads
.
push_back
(
thread
);
}
}
};
// Retrieve all threads that are waiting for this address.
std
::
vector
<
SharedPtr
<
Thread
>>
threads
;
RetrieveWaitingThreads
(
0
,
threads
,
address
);
RetrieveWaitingThreads
(
1
,
threads
,
address
);
RetrieveWaitingThreads
(
2
,
threads
,
address
);
RetrieveWaitingThreads
(
3
,
threads
,
address
);
const
auto
&
scheduler
=
system
.
GlobalScheduler
();
const
auto
&
thread_list
=
scheduler
.
GetThreadList
();
for
(
const
auto
&
thread
:
thread_list
)
{
if
(
thread
->
GetArbiterWaitAddress
()
==
address
)
{
threads
.
push_back
(
thread
);
}
}
// Sort them by priority, such that the highest priority ones come first.
std
::
sort
(
threads
.
begin
(),
threads
.
end
(),
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/kernel/mutex.cpp
+
2
−
0
View file @
b5d1e447
...
...
@@ -140,6 +140,8 @@ ResultCode Mutex::Release(VAddr address) {
thread
->
SetMutexWaitAddress
(
0
);
thread
->
SetWaitHandle
(
0
);
Core
::
System
::
GetInstance
().
PrepareReschedule
();
return
RESULT_SUCCESS
;
}
}
// namespace Kernel
This diff is collapsed.
Click to expand it.
src/core/hle/kernel/wait_object.cpp
+
4
−
0
View file @
b5d1e447
...
...
@@ -6,6 +6,8 @@
#include
"common/assert.h"
#include
"common/common_types.h"
#include
"common/logging/log.h"
#include
"core/core.h"
#include
"core/core_cpu.h"
#include
"core/hle/kernel/object.h"
#include
"core/hle/kernel/process.h"
#include
"core/hle/kernel/thread.h"
...
...
@@ -95,6 +97,8 @@ void WaitObject::WakeupWaitingThread(SharedPtr<Thread> thread) {
}
if
(
resume
)
{
thread
->
ResumeFromWait
();
if
(
thread
->
GetProcessorID
()
>=
0
)
Core
::
System
::
GetInstance
().
CpuCore
(
thread
->
GetProcessorID
()).
PrepareReschedule
();
}
}
...
...
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