summaryrefslogtreecommitdiff
path: root/core/os/thread.h
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2022-08-24 11:33:52 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2022-10-04 11:43:28 +0200
commit958ecf55fed9d236a6b0dca2a1b88e1b401df971 (patch)
tree18ffc0e63ec6b6cab11cde3e4cd1ca88efc92d83 /core/os/thread.h
parent1371a97acfb9263aaca7fa8642e95ba68534fa19 (diff)
Enhance portability of threading
Diffstat (limited to 'core/os/thread.h')
-rw-r--r--core/os/thread.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/core/os/thread.h b/core/os/thread.h
index 7462ec17fb..86442de760 100644
--- a/core/os/thread.h
+++ b/core/os/thread.h
@@ -63,6 +63,14 @@ public:
Settings() { priority = PRIORITY_NORMAL; }
};
+ struct PlatformFunctions {
+ Error (*set_name)(const String &) = nullptr;
+ void (*set_priority)(Thread::Priority) = nullptr;
+ void (*init)() = nullptr;
+ void (*wrapper)(Thread::Callback, void *) = nullptr;
+ void (*term)() = nullptr;
+ };
+
private:
friend class Main;
@@ -76,17 +84,10 @@ private:
static void callback(Thread *p_self, const Settings &p_settings, Thread::Callback p_callback, void *p_userdata);
- static Error (*set_name_func)(const String &);
- static void (*set_priority_func)(Thread::Priority);
- static void (*init_func)();
- static void (*term_func)();
+ static PlatformFunctions platform_functions;
public:
- static void _set_platform_funcs(
- Error (*p_set_name_func)(const String &),
- void (*p_set_priority_func)(Thread::Priority),
- void (*p_init_func)() = nullptr,
- void (*p_term_func)() = nullptr);
+ static void _set_platform_functions(const PlatformFunctions &p_functions);
_FORCE_INLINE_ ID get_id() const { return id; }
// get the ID of the caller thread