summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibThread
diff options
context:
space:
mode:
authorJean-Baptiste Boric <jblbeurope@gmail.com>2021-04-26 19:09:04 +0200
committerLinus Groh <mail@linusgroh.de>2021-04-27 23:06:16 +0200
commit8d95bd84183ee4b8658705ad4b9b197caf5ac4f2 (patch)
treed4079b5c86aa900f6c3a8311fba67f123fc5f80f /Userland/Libraries/LibThread
parent7d84f09e7e1943813242c7d8ee0e60b46697ec60 (diff)
downloadserenity-8d95bd84183ee4b8658705ad4b9b197caf5ac4f2.zip
LibThread: Fix int to pointer conversion
Diffstat (limited to 'Userland/Libraries/LibThread')
-rw-r--r--Userland/Libraries/LibThread/BackgroundAction.cpp2
-rw-r--r--Userland/Libraries/LibThread/Thread.cpp6
-rw-r--r--Userland/Libraries/LibThread/Thread.h6
3 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Libraries/LibThread/BackgroundAction.cpp b/Userland/Libraries/LibThread/BackgroundAction.cpp
index 34ab7b5fcb..392141e445 100644
--- a/Userland/Libraries/LibThread/BackgroundAction.cpp
+++ b/Userland/Libraries/LibThread/BackgroundAction.cpp
@@ -12,7 +12,7 @@
static LibThread::Lockable<Queue<Function<void()>>>* s_all_actions;
static LibThread::Thread* s_background_thread;
-static int background_thread_func()
+static intptr_t background_thread_func()
{
while (true) {
Function<void()> work_item;
diff --git a/Userland/Libraries/LibThread/Thread.cpp b/Userland/Libraries/LibThread/Thread.cpp
index 941ffbfea1..db3aeb0022 100644
--- a/Userland/Libraries/LibThread/Thread.cpp
+++ b/Userland/Libraries/LibThread/Thread.cpp
@@ -9,7 +9,7 @@
#include <string.h>
#include <unistd.h>
-LibThread::Thread::Thread(Function<int()> action, StringView thread_name)
+LibThread::Thread::Thread(Function<intptr_t()> action, StringView thread_name)
: Core::Object(nullptr)
, m_action(move(action))
, m_thread_name(thread_name.is_null() ? "" : thread_name)
@@ -33,9 +33,9 @@ void LibThread::Thread::start()
nullptr,
[](void* arg) -> void* {
Thread* self = static_cast<Thread*>(arg);
- int exit_code = self->m_action();
+ auto exit_code = self->m_action();
self->m_tid = 0;
- return (void*)exit_code;
+ return reinterpret_cast<void*>(exit_code);
},
static_cast<void*>(this));
diff --git a/Userland/Libraries/LibThread/Thread.h b/Userland/Libraries/LibThread/Thread.h
index 8696b86b46..255d8f8903 100644
--- a/Userland/Libraries/LibThread/Thread.h
+++ b/Userland/Libraries/LibThread/Thread.h
@@ -15,7 +15,7 @@
namespace LibThread {
-TYPEDEF_DISTINCT_ORDERED_ID(int, ThreadError);
+TYPEDEF_DISTINCT_ORDERED_ID(intptr_t, ThreadError);
class Thread final : public Core::Object {
C_OBJECT(Thread);
@@ -32,8 +32,8 @@ public:
pthread_t tid() const { return m_tid; }
private:
- explicit Thread(Function<int()> action, StringView thread_name = nullptr);
- Function<int()> m_action;
+ explicit Thread(Function<intptr_t()> action, StringView thread_name = nullptr);
+ Function<intptr_t()> m_action;
pthread_t m_tid { 0 };
String m_thread_name;
};