diff --git a/orbis-kernel/include/orbis/thread/ProcessOps.hpp b/orbis-kernel/include/orbis/thread/ProcessOps.hpp index 71e420261..161f74abd 100644 --- a/orbis-kernel/include/orbis/thread/ProcessOps.hpp +++ b/orbis-kernel/include/orbis/thread/ProcessOps.hpp @@ -40,7 +40,7 @@ struct ProcessOps { SysResult (*dynlib_unload_prx)(Thread *thread, ModuleHandle handle); SysResult (*thr_create)(Thread *thread, ptr ctxt, ptr arg, sint flags); - SysResult (*thr_new)(Thread *thread, ptr param, sint param_size); + SysResult (*thr_new)(Thread *thread, ptr param, sint param_size); SysResult (*thr_exit)(Thread *thread, ptr state); SysResult (*thr_kill)(Thread *thread, slong id, sint sig); SysResult (*thr_kill2)(Thread *thread, pid_t pid, slong id, sint sig); diff --git a/orbis-kernel/include/orbis/thread/Thread.hpp b/orbis-kernel/include/orbis/thread/Thread.hpp index 1ad22abc5..5dce313c5 100644 --- a/orbis-kernel/include/orbis/thread/Thread.hpp +++ b/orbis-kernel/include/orbis/thread/Thread.hpp @@ -26,5 +26,9 @@ struct Thread { lwpid_t tid = -1; ThreadState state = ThreadState::INACTIVE; + + // FIXME: implement thread destruction + void incRef() {} + void decRef() {} }; } // namespace orbis diff --git a/orbis-kernel/include/orbis/thread/types.hpp b/orbis-kernel/include/orbis/thread/types.hpp index 7f632162a..66cd6413e 100644 --- a/orbis-kernel/include/orbis/thread/types.hpp +++ b/orbis-kernel/include/orbis/thread/types.hpp @@ -6,4 +6,22 @@ using lwpid_t = int32_t; using pid_t = int64_t; using uid_t = uint32_t; using gid_t = uint32_t; + +struct rtprio { + uint16_t type; + uint16_t prio; +}; + +struct thr_param { + ptr start_func; + ptr arg; + ptr stack_base; + size_t stack_size; + ptr tls_base; + size_t tls_size; + ptr child_tid; // Address to store the new thread identifier, for the child's use + ptr parent_tid; // Address to store the new thread identifier, for the parent's use + sint flags; // Thread creation flags. The flags member may specify the following flags: + ptr rtp; // Real-time scheduling priority for the new thread. May be NULL to inherit the priority from the creating thread +}; } // namespace orbis diff --git a/orbis-kernel/include/orbis/utils/Rc.hpp b/orbis-kernel/include/orbis/utils/Rc.hpp index bff611f60..7f8cc7eb0 100644 --- a/orbis-kernel/include/orbis/utils/Rc.hpp +++ b/orbis-kernel/include/orbis/utils/Rc.hpp @@ -52,7 +52,9 @@ public: template requires(std::is_base_of_v) Ref(OT *ref) : m_ref(ref) { - ref->incRef(); + if (m_ref != nullptr) { + ref->incRef(); + } } template