MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / runThread

Method runThread

source/core/StarThread_windows.cpp:46–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44
45struct ThreadImpl {
46 static DWORD WINAPI runThread(void* data) {
47 ThreadImpl* ptr = static_cast<ThreadImpl*>(data);
48 try {
49 unsigned long exceptionStackSize = 131072;
50 SetThreadStackGuarantee(&exceptionStackSize);
51 ptr->function();
52 } catch (std::exception const& e) {
53 if (ptr->name.empty())
54 Logger::error("Exception caught in Thread: {}", outputException(e, true));
55 else
56 Logger::error("Exception caught in Thread {}: {}", ptr->name, outputException(e, true));
57 } catch (...) {
58 if (ptr->name.empty())
59 Logger::error("Unknown exception caught in Thread");
60 else
61 Logger::error("Unknown exception caught in Thread {}", ptr->name);
62 }
63 ptr->stopped = true;
64 return 0;
65 }
66
67 ThreadImpl(std::function<void()> function, String name)
68 : function(std::move(function)), name(std::move(name)), thread(INVALID_HANDLE_VALUE), stopped(true) {}

Callers

nothing calls this directly

Calls 4

errorFunction · 0.85
functionMethod · 0.80
outputExceptionFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected