mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-20 06:30:09 +00:00
kernel: updated SyncRequest to take boolean thread wait result as a parameter
This commit is contained in:
parent
6e51c56fe4
commit
58a3adcdd2
@ -47,7 +47,14 @@ public:
|
|||||||
virtual const char *GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; }
|
virtual const char *GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; }
|
||||||
virtual const char *GetName() { return "[UNKNOWN KERNEL OBJECT]"; }
|
virtual const char *GetName() { return "[UNKNOWN KERNEL OBJECT]"; }
|
||||||
virtual Kernel::HandleType GetHandleType() const = 0;
|
virtual Kernel::HandleType GetHandleType() const = 0;
|
||||||
virtual Result SyncRequest() = 0;
|
|
||||||
|
/**
|
||||||
|
* Synchronize kernel object
|
||||||
|
* @param wait Boolean wait set if current thread should wait as a result of sync operation
|
||||||
|
* @return Result of operation, 0 on success, otherwise error code
|
||||||
|
*/
|
||||||
|
virtual Result SyncRequest(bool* wait) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ObjectPool : NonCopyable {
|
class ObjectPool : NonCopyable {
|
||||||
|
@ -24,8 +24,12 @@ public:
|
|||||||
Handle lock_thread; ///< Handle to thread that currently has mutex
|
Handle lock_thread; ///< Handle to thread that currently has mutex
|
||||||
std::vector<Handle> waiting_threads; ///< Threads that are waiting for the mutex
|
std::vector<Handle> waiting_threads; ///< Threads that are waiting for the mutex
|
||||||
|
|
||||||
/// Synchronize kernel object
|
/**
|
||||||
Result SyncRequest() {
|
* Synchronize kernel object
|
||||||
|
* @param wait Boolean wait set if current thread should wait as a result of sync operation
|
||||||
|
* @return Result of operation, 0 on success, otherwise error code
|
||||||
|
*/
|
||||||
|
Result SyncRequest(bool* wait) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -36,8 +36,12 @@ public:
|
|||||||
inline bool IsWaiting() const { return (status & THREADSTATUS_WAIT) != 0; }
|
inline bool IsWaiting() const { return (status & THREADSTATUS_WAIT) != 0; }
|
||||||
inline bool IsSuspended() const { return (status & THREADSTATUS_SUSPEND) != 0; }
|
inline bool IsSuspended() const { return (status & THREADSTATUS_SUSPEND) != 0; }
|
||||||
|
|
||||||
/// Synchronize kernel object
|
/**
|
||||||
Result SyncRequest() {
|
* Synchronize kernel object
|
||||||
|
* @param wait Boolean wait set if current thread should wait as a result of sync operation
|
||||||
|
* @return Result of operation, 0 on success, otherwise error code
|
||||||
|
*/
|
||||||
|
Result SyncRequest(bool* wait) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +76,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when svcSendSyncRequest is called, loads command buffer and executes comand
|
* Synchronize kernel object
|
||||||
* @return Return result of svcSendSyncRequest passed back to user app
|
* @param wait Boolean wait set if current thread should wait as a result of sync operation
|
||||||
|
* @return Result of operation, 0 on success, otherwise error code
|
||||||
*/
|
*/
|
||||||
Result SyncRequest() {
|
Result SyncRequest(bool* wait) {
|
||||||
u32* cmd_buff = GetCommandBuffer();
|
u32* cmd_buff = GetCommandBuffer();
|
||||||
auto itr = m_functions.find(cmd_buff[0]);
|
auto itr = m_functions.find(cmd_buff[0]);
|
||||||
|
|
||||||
|
@ -92,11 +92,18 @@ Result ConnectToPort(void* out, const char* port_name) {
|
|||||||
|
|
||||||
/// Synchronize to an OS service
|
/// Synchronize to an OS service
|
||||||
Result SendSyncRequest(Handle handle) {
|
Result SendSyncRequest(Handle handle) {
|
||||||
|
bool wait = false;
|
||||||
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
|
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
|
||||||
|
|
||||||
DEBUG_LOG(SVC, "SendSyncRequest called handle=0x%08X");
|
DEBUG_LOG(SVC, "SendSyncRequest called handle=0x%08X");
|
||||||
_assert_msg_(KERNEL, object, "SendSyncRequest called, but kernel object is NULL!");
|
_assert_msg_(KERNEL, object, "SendSyncRequest called, but kernel object is NULL!");
|
||||||
object->SyncRequest();
|
|
||||||
return 0;
|
Result res = object->SyncRequest(&wait);
|
||||||
|
if (wait) {
|
||||||
|
Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Close a handle
|
/// Close a handle
|
||||||
|
Loading…
Reference in New Issue
Block a user