mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Allow sync HTTP fetches to be interrupted to fix hanging (#14412)
Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
This commit is contained in:
parent
32f68f35cf
commit
f07e1026ac
6 changed files with 56 additions and 11 deletions
|
@ -62,6 +62,9 @@ DEALINGS IN THE SOFTWARE.
|
|||
// See https://msdn.microsoft.com/en-us/library/hh920601.aspx#thread__native_handle_method
|
||||
#define win32_native_handle() ((HANDLE) getThreadHandle())
|
||||
|
||||
thread_local Thread *current_thread = nullptr;
|
||||
|
||||
|
||||
Thread::Thread(const std::string &name) :
|
||||
m_name(name),
|
||||
m_request_stop(false),
|
||||
|
@ -177,6 +180,8 @@ void Thread::threadProc(Thread *thr)
|
|||
thr->m_kernel_thread_id = thread_self();
|
||||
#endif
|
||||
|
||||
current_thread = thr;
|
||||
|
||||
thr->setName(thr->m_name);
|
||||
|
||||
g_logger.registerThread(thr->m_name);
|
||||
|
@ -197,6 +202,12 @@ void Thread::threadProc(Thread *thr)
|
|||
}
|
||||
|
||||
|
||||
Thread *Thread::getCurrentThread()
|
||||
{
|
||||
return current_thread;
|
||||
}
|
||||
|
||||
|
||||
void Thread::setName(const std::string &name)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue