diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /drivers/windows/thread_windows.cpp | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'drivers/windows/thread_windows.cpp')
| -rw-r--r-- | drivers/windows/thread_windows.cpp | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index dbe2f93fd..e6143b4af 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -32,24 +32,23 @@ #include "os/memory.h" - Thread::ID ThreadWindows::get_ID() const { - return id; + return id; } -Thread* ThreadWindows::create_thread_windows() { +Thread *ThreadWindows::create_thread_windows() { - return memnew( ThreadWindows ); + return memnew(ThreadWindows); } -DWORD ThreadWindows::thread_callback( LPVOID userdata ) { +DWORD ThreadWindows::thread_callback(LPVOID userdata) { - ThreadWindows *t=reinterpret_cast<ThreadWindows*>(userdata); + ThreadWindows *t = reinterpret_cast<ThreadWindows *>(userdata); ScriptServer::thread_enter(); //scripts may need to attach a stack - t->id=(ID)GetCurrentThreadId(); // must implement + t->id = (ID)GetCurrentThreadId(); // must implement t->callback(t->user); ScriptServer::thread_exit(); @@ -57,53 +56,47 @@ DWORD ThreadWindows::thread_callback( LPVOID userdata ) { return 0; } -Thread* ThreadWindows::create_func_windows(ThreadCreateCallback p_callback,void *p_user,const Settings&) { +Thread *ThreadWindows::create_func_windows(ThreadCreateCallback p_callback, void *p_user, const Settings &) { + + ThreadWindows *tr = memnew(ThreadWindows); + tr->callback = p_callback; + tr->user = p_user; + tr->handle = CreateThread( + NULL, // default security attributes + 0, // use default stack size + thread_callback, // thread function name + tr, // argument to thread function + 0, // use default creation flags + NULL); // returns the thread identifier - ThreadWindows *tr= memnew(ThreadWindows); - tr->callback=p_callback; - tr->user=p_user; - tr->handle=CreateThread( - NULL, // default security attributes - 0, // use default stack size - thread_callback, // thread function name - tr, // argument to thread function - 0, // use default creation flags - NULL); // returns the thread identifier - return tr; } Thread::ID ThreadWindows::get_thread_ID_func_windows() { return (ID)GetCurrentThreadId(); //must implement } -void ThreadWindows::wait_to_finish_func_windows(Thread* p_thread) { +void ThreadWindows::wait_to_finish_func_windows(Thread *p_thread) { - - ThreadWindows *tp=static_cast<ThreadWindows*>(p_thread); + ThreadWindows *tp = static_cast<ThreadWindows *>(p_thread); ERR_FAIL_COND(!tp); - WaitForSingleObject( tp->handle, INFINITE ); + WaitForSingleObject(tp->handle, INFINITE); CloseHandle(tp->handle); - //`memdelete(tp); + //`memdelete(tp); } - void ThreadWindows::make_default() { - create_func=create_func_windows; - get_thread_ID_func=get_thread_ID_func_windows; - wait_to_finish_func=wait_to_finish_func_windows; - + create_func = create_func_windows; + get_thread_ID_func = get_thread_ID_func_windows; + wait_to_finish_func = wait_to_finish_func_windows; } ThreadWindows::ThreadWindows() { - handle=NULL; + handle = NULL; } - ThreadWindows::~ThreadWindows() { - } - #endif |
