mirror of
https://github.com/minetest/minetest.git
synced 2025-03-06 20:48:40 +01:00
Const correct Thread class (#15741)
This commit is contained in:
parent
9166b57c2a
commit
045951b23c
3 changed files with 8 additions and 8 deletions
|
@ -744,7 +744,7 @@ static void httpfetch_request_clear(u64 caller)
|
||||||
bool httpfetch_sync_interruptible(const HTTPFetchRequest &fetch_request,
|
bool httpfetch_sync_interruptible(const HTTPFetchRequest &fetch_request,
|
||||||
HTTPFetchResult &fetch_result, long interval)
|
HTTPFetchResult &fetch_result, long interval)
|
||||||
{
|
{
|
||||||
if (Thread *thread = Thread::getCurrentThread()) {
|
if (const Thread *thread = Thread::getCurrentThread()) {
|
||||||
HTTPFetchRequest req = fetch_request;
|
HTTPFetchRequest req = fetch_request;
|
||||||
req.caller = httpfetch_caller_alloc_secure();
|
req.caller = httpfetch_caller_alloc_secure();
|
||||||
httpfetch_async(req);
|
httpfetch_async(req);
|
||||||
|
|
|
@ -164,7 +164,7 @@ bool Thread::wait()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Thread::getReturnValue(void **ret)
|
bool Thread::getReturnValue(void **ret) const
|
||||||
{
|
{
|
||||||
if (m_running)
|
if (m_running)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -86,19 +86,19 @@ public:
|
||||||
/*
|
/*
|
||||||
* Returns true if the calling thread is this Thread object.
|
* Returns true if the calling thread is this Thread object.
|
||||||
*/
|
*/
|
||||||
bool isCurrentThread() { return std::this_thread::get_id() == getThreadId(); }
|
bool isCurrentThread() const { return std::this_thread::get_id() == getThreadId(); }
|
||||||
|
|
||||||
bool isRunning() { return m_running; }
|
bool isRunning() const { return m_running; }
|
||||||
bool stopRequested() { return m_request_stop; }
|
bool stopRequested() const { return m_request_stop; }
|
||||||
|
|
||||||
std::thread::id getThreadId() { return m_thread_obj->get_id(); }
|
std::thread::id getThreadId() const { return m_thread_obj->get_id(); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gets the thread return value.
|
* Gets the thread return value.
|
||||||
* Returns true if the thread has exited and the return value was available,
|
* Returns true if the thread has exited and the return value was available,
|
||||||
* or false if the thread has yet to finish.
|
* or false if the thread has yet to finish.
|
||||||
*/
|
*/
|
||||||
bool getReturnValue(void **ret);
|
bool getReturnValue(void **ret) const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Binds (if possible, otherwise sets the affinity of) the thread to the
|
* Binds (if possible, otherwise sets the affinity of) the thread to the
|
||||||
|
@ -142,7 +142,7 @@ protected:
|
||||||
virtual void *run() = 0;
|
virtual void *run() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::thread::native_handle_type getThreadHandle()
|
std::thread::native_handle_type getThreadHandle() const
|
||||||
{ return m_thread_obj->native_handle(); }
|
{ return m_thread_obj->native_handle(); }
|
||||||
|
|
||||||
static void threadProc(Thread *thr);
|
static void threadProc(Thread *thr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue