mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6.
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