mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user