aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.h
Commit message (Collapse)AuthorAgeFilesLines
* core: Implement separate A32/A64 ARM interfaces.bunnei2020-03-021-6/+16
|
* Kernel: Rename ThreadCallbackHandleTable and Setup Thread Ids on Kernel.Fernando Sahmkow2020-02-221-1/+5
|
* Kernel: Refactor synchronization to better match REFernando Sahmkow2020-02-111-0/+1
|
* Kernel: Change WaitObject to Synchronization object. In order to better ↵Fernando Sahmkow2020-02-111-11/+11
| | | | reflect RE.
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for ↵bunnei2019-11-241-19/+20
| | | | | | | | kernel objects. (#3154) * kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. - See https://github.com/citra-emu/citra/pull/4710 for details.
* Kernel: Correct Cancel Synchronization.Fernando Sahmkow2019-11-161-0/+9
| | | | | | This commit corrects the behavior of cancel synchronization when the thread is running/ready and ensures the next wait is cancelled as it's suppose to.
* Kernel Thread: Cleanup THREADPROCESSORID_DONT_UPDATE.Fernando Sahmkow2019-10-151-3/+0
|
* Kernel: Address Feedback 2Fernando Sahmkow2019-10-151-6/+3
|
* Kernel: Address Feedback.Fernando Sahmkow2019-10-151-4/+12
|
* Kernel: Corrections to Wait Objects clearing in which a thread could still ↵Fernando Sahmkow2019-10-151-0/+3
| | | | be signalled after a timeout or a cancel.
* Kernel: Clang FormatFernando Sahmkow2019-10-151-1/+1
|
* Scheduler: Implement Yield Count and Core migration on Thread Preemption.Fernando Sahmkow2019-10-151-0/+9
|
* Scheduler: Add protections for Yield bombingFernando Sahmkow2019-10-151-3/+3
| | | | | | In case of redundant yields, the scheduler will now idle the core for it's timeslice, in order to avoid continuously yielding the same thing over and over.
* Kernel: Style and CorrectionsFernando Sahmkow2019-10-151-5/+10
|
* Addapt thread class to the new SchedulerFernando Sahmkow2019-10-151-1/+54
|
* kernel/process: Decouple TLS handling from threadsLioncash2019-07-031-15/+1
| | | | | | | | | | | Extracts out all of the thread local storage management from thread instances themselves and makes the owning process handle the management of the memory. This brings the memory management slightly more in line with how the kernel handles these allocations. Furthermore, this also makes the TLS page management a little more readable compared to the lingering implementation that was carried over from Citra.
* Merge pull request #2410 from lioncash/affinitybunnei2019-05-191-6/+15
|\ | | | | kernel/svc: Reorganize and fix up the initial handling of svcSetThreadCoreMask()
| * kernel/thread: Update thread processor ID flagsLioncash2019-04-291-6/+15
| | | | | | | | Adds the missing flags to the enum and documents them.
* | Merge pull request #2416 from lioncash/waitbunnei2019-04-241-18/+22
|\ \ | | | | | | kernel/svc: Clean up wait synchronization related functionality
| * | kernel/thread: Unify wait synchronization typesLioncash2019-04-171-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a holdover from Citra, where the 3DS has both WaitSynchronization1 and WaitSynchronizationN. The switch only has one form of wait synchronizing (literally WaitSynchonization). This allows us to throw out code that doesn't apply at all to the Switch kernel. Because of this unnecessary dichotomy within the wait synchronization utilities, we were also neglecting to properly handle waiting on multiple objects. While we're at it, we can also scrub out any lingering references to WaitSynchronization1/WaitSynchronizationN in comments, and change them to WaitSynchronization (or remove them if the mention no longer applies).
| * | kernel/svc: Migrate svcCancelSynchronization behavior to a thread functionLioncash2019-04-171-3/+9
| | | | | | | | | | | | | | | | | | | | | The actual behavior of this function is slightly more complex than what we're currently doing within the supervisor call. To avoid dumping most of this behavior in the supervisor call itself, we can migrate this to another function.
* | | Merge pull request #2397 from lioncash/thread-unusedbunnei2019-04-171-7/+5
|\ \ \ | |/ / |/| | kernel/thread: Remove unused guest_handle member variable
| * | svc: Specify handle value in thread's nameLioncash2019-04-151-0/+5
| | | | | | | | | | | | Allows the handle to be seen alongside the entry point.
| * | kernel/thread: Remove unused guest_handle member variableLioncash2019-04-141-7/+0
| |/ | | | | | | | | | | This member variable is entirely unused. It was only set but never actually utilized. Given that, we can remove it to get rid of noise in the thread interface.
* / kernel/thread: Remove BoostPriority()Lioncash2019-04-151-6/+0
|/ | | | | This is a holdover from Citra that currently remains unused, so it can be removed from the Thread interface.
* kernel: Make handle type declarations constexprLioncash2019-04-111-1/+1
| | | | | | | Some objects declare their handle type as const, while others declare it as constexpr. This makes the const ones constexpr for consistency, and prevent unexpected compilation errors if these happen to be attempted to be used within a constexpr context.
* kernel/thread: Make AllWaitObjectsReady() a const qualified member functionLioncash2019-04-011-1/+1
| | | | | | Now that ShouldWait() is a const qualified member function, this one can be made const qualified as well, since it can handle passing a const qualified this pointer to ShouldWait().
* kernel/wait_object: Make ShouldWait() take thread members by pointer-to-constLioncash2019-04-011-1/+1
| | | | | Given this is intended as a querying function, it doesn't make sense to allow the implementer to modify the state of the given thread.
* kernel/thread: Make parameter of GetWaitObjectIndex() const qualifiedLioncash2019-04-011-1/+1
| | | | | The pointed to member is never actually modified, so it can be made const.
* Add CondVar Thread State.Fernando Sahmkow2019-03-191-1/+2
|
* Merge pull request #2238 from lioncash/threadbunnei2019-03-171-2/+8
|\ | | | | kernel/thread: Amend conditional test and assignment within UpdatePriority()
| * kernel/thread: Expand documentation of nominal_priority and current_priorityLioncash2019-03-151-2/+8
| | | | | | | | | | Aims to disambiguate why each priority instance exists a little bit. While we're at it, also add an explanatory comment to UpdatePriority().
* | kernel/thread: Move thread exiting logic from ExitCurrentThread to svcExitThreadLioncash2019-03-151-5/+0
| | | | | | | | | | Puts the operation on global state in the same places as the rest of the svc calls.
* | kernel/thread: Migrate WaitCurrentThread_Sleep into the Thread interfaceLioncash2019-03-151-5/+3
|/ | | | | | Rather than make a global accessor for this sort of thing. We can make it a part of the thread interface itself. This allows getting rid of a hidden global accessor in the kernel code.
* kernel: Rename 'default' CPU core to 'ideal' coreLioncash2018-12-271-6/+6
| | | | | | This makes the naming more closely match its meaning. It's just a preferred core, not a required default core. This also makes the usages of this term consistent across the thread and process implementations.
* kernel/thread: Move process thread initialization into process.cppLioncash2018-12-271-11/+0
| | | | | | | | | | This function isn't a general purpose function that should be exposed to everything, given it's specific to initializing the main thread for a Process instance. Given that, it's a tad bit more sensible to place this within process.cpp, which keeps it visible only to the code that actually needs it.
* Merge pull request #1849 from encounter/svcSetThreadActivitybunnei2018-12-261-0/+14
|\ | | | | svc: Implement SetThreadActivity (thread suspension)
| * svc: Implement SetThreadActivity (thread suspension)Luke Street2018-12-041-0/+14
| |
* | kernel/thread: Make thread_id a 64-bit valueLioncash2018-12-181-2/+2
| | | | | | | | | | The kernel uses a 64-bit value for the thread ID, so we shouldn't be using a 32-bit value.
* | scheduler: Add explanations for YieldWith and WithoutLoadBalancingZach Hilman2018-11-221-4/+0
| |
* | svc: Implement yield types 0 and -1Zach Hilman2018-11-181-0/+5
|/
* kernel/thread: Deduplicate scheduler switching codeLioncash2018-11-141-0/+2
| | | | | The code in both places was the same verbatim, so we can extract it to a function to deduplicate the logic.
* svc: Implement svcGetInfo command 0xF0000002Lioncash2018-10-261-1/+10
| | | | | | | | | | This retrieves: if (curr_thread == handle_thread) { result = total_thread_ticks + (hardware_tick_count - last_context_switch_ticks); } else if (curr_thread == handle_thread && sub_id == current_core_index) { result = hardware_tick_count - last_context_switch_ticks; }
* kernel/thread: Use a regular pointer for the owner/current processLioncash2018-10-101-4/+4
| | | | | | | | | | | There's no real need to use a shared pointer in these cases, and only makes object management more fragile in terms of how easy it would be to introduce cycles. Instead, just do the simple thing of using a regular pointer. Much of this is just a hold-over from citra anyways. It also doesn't make sense from a behavioral point of view for a process' thread to prolong the lifetime of the process itself (the process is supposed to own the thread, not the other way around).
* thread: Make the scheduler pointer a regular pointerbalika0112018-10-051-1/+1
| | | | | | | | | | | | | | Conceptually, it doesn't make sense for a thread to be able to persist the lifetime of a scheduler. A scheduler should be taking care of the threads; the threads should not be taking care of the scheduler. If the threads outlive the scheduler (or we simply don't actually terminate/shutdown the threads), then it should be considered a bug that we need to fix. Attributing this to balika011, as they opened #1317 to attempt to fix this in a similar way, but my refactoring of the kernel code caused quite a few conflicts.
* kernel/thread: Make all instance variables privateLioncash2018-10-041-35/+181
| | | | | | | | | | | | | | | | | | | | Many of the member variables of the thread class aren't even used outside of the class itself, so there's no need to make those variables public. This change follows in the steps of the previous changes that made other kernel types' members private. The main motivation behind this is that the Thread class will likely change in the future as emulation becomes more accurate, and letting random bits of the emulator access data members of the Thread class directly makes it a pain to shuffle around and/or modify internals. Having all data members public like this also makes it difficult to reason about certain bits of behavior without first verifying what parts of the core actually use them. Everything being public also generally follows the tendency for changes to be introduced in completely different translation units that would otherwise be better introduced as an addition to the Thread class' public interface.
* thread/process: Move TLS slot marking/freeing to the process classLioncash2018-09-211-1/+12
| | | | | | Allows making several members of the process class private, it also avoids going through Core::CurrentProcess() just to retrieve the owning process.
* kernel/thread: Use owner_process when setting the page table in ↵Lioncash2018-09-201-1/+1
| | | | | | | | | SetupMainThread() The owning process of a thread is required to exist before the thread, so we can enforce this API-wise by using a reference. We can also avoid the reliance on the system instance by using that parameter to access the page table that needs to be set.
* Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi2018-09-151-1/+1
|
* kernel/thread: Include thread-related enums within the kernel namespaceLioncash2018-09-131-6/+6
| | | | | | Previously, these were sitting outside of the Kernel namespace, which doesn't really make sense, given they're related to the Thread class which is within the Kernel namespace.