mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:47:34 +00:00
LibThread: Fix int to pointer conversion
This commit is contained in:
parent
7d84f09e7e
commit
8d95bd8418
5 changed files with 9 additions and 9 deletions
|
@ -84,7 +84,7 @@ Debug::DebugInfo::SourcePosition Debugger::create_source_position(const String&
|
||||||
return { LexicalPath::canonicalized_path(String::formatted("{}/{}", m_source_root, file)), line + 1 };
|
return { LexicalPath::canonicalized_path(String::formatted("{}/{}", m_source_root, file)), line + 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
int Debugger::start_static()
|
intptr_t Debugger::start_static()
|
||||||
{
|
{
|
||||||
Debugger::the().start();
|
Debugger::the().start();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
// Thread entry point
|
// Thread entry point
|
||||||
static int start_static();
|
static intptr_t start_static();
|
||||||
|
|
||||||
pthread_mutex_t* continue_mutex() { return &m_ui_action_mutex; }
|
pthread_mutex_t* continue_mutex() { return &m_ui_action_mutex; }
|
||||||
pthread_cond_t* continue_cond() { return &m_ui_action_cond; }
|
pthread_cond_t* continue_cond() { return &m_ui_action_cond; }
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
static LibThread::Lockable<Queue<Function<void()>>>* s_all_actions;
|
static LibThread::Lockable<Queue<Function<void()>>>* s_all_actions;
|
||||||
static LibThread::Thread* s_background_thread;
|
static LibThread::Thread* s_background_thread;
|
||||||
|
|
||||||
static int background_thread_func()
|
static intptr_t background_thread_func()
|
||||||
{
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
Function<void()> work_item;
|
Function<void()> work_item;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.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)
|
: Core::Object(nullptr)
|
||||||
, m_action(move(action))
|
, m_action(move(action))
|
||||||
, m_thread_name(thread_name.is_null() ? "" : thread_name)
|
, m_thread_name(thread_name.is_null() ? "" : thread_name)
|
||||||
|
@ -33,9 +33,9 @@ void LibThread::Thread::start()
|
||||||
nullptr,
|
nullptr,
|
||||||
[](void* arg) -> void* {
|
[](void* arg) -> void* {
|
||||||
Thread* self = static_cast<Thread*>(arg);
|
Thread* self = static_cast<Thread*>(arg);
|
||||||
int exit_code = self->m_action();
|
auto exit_code = self->m_action();
|
||||||
self->m_tid = 0;
|
self->m_tid = 0;
|
||||||
return (void*)exit_code;
|
return reinterpret_cast<void*>(exit_code);
|
||||||
},
|
},
|
||||||
static_cast<void*>(this));
|
static_cast<void*>(this));
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
namespace LibThread {
|
namespace LibThread {
|
||||||
|
|
||||||
TYPEDEF_DISTINCT_ORDERED_ID(int, ThreadError);
|
TYPEDEF_DISTINCT_ORDERED_ID(intptr_t, ThreadError);
|
||||||
|
|
||||||
class Thread final : public Core::Object {
|
class Thread final : public Core::Object {
|
||||||
C_OBJECT(Thread);
|
C_OBJECT(Thread);
|
||||||
|
@ -32,8 +32,8 @@ public:
|
||||||
pthread_t tid() const { return m_tid; }
|
pthread_t tid() const { return m_tid; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Thread(Function<int()> action, StringView thread_name = nullptr);
|
explicit Thread(Function<intptr_t()> action, StringView thread_name = nullptr);
|
||||||
Function<int()> m_action;
|
Function<intptr_t()> m_action;
|
||||||
pthread_t m_tid { 0 };
|
pthread_t m_tid { 0 };
|
||||||
String m_thread_name;
|
String m_thread_name;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue