From 33ddb3ad4d2d43356983fc70647aac9bee5b31d4 Mon Sep 17 00:00:00 2001 From: Mikkel Hjortshoej Date: Sun, 25 Feb 2018 14:38:55 +0100 Subject: [PATCH 1/2] Added terminate_thread to thread.odin --- core/sys/windows.odin | 3 ++- core/thread.odin | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/sys/windows.odin b/core/sys/windows.odin index 54a4c3705..40abc8f8c 100644 --- a/core/sys/windows.odin +++ b/core/sys/windows.odin @@ -681,7 +681,8 @@ foreign kernel32 { @(link_name="ResumeThread") resume_thread :: proc(thread: Handle) -> u32 ---; @(link_name="GetThreadPriority") get_thread_priority :: proc(thread: Handle) -> i32 ---; @(link_name="SetThreadPriority") set_thread_priority :: proc(thread: Handle, priority: i32) -> Bool ---; - @(link_name="GetExitCodeThread") get_exit_code_thread :: proc(thread: Handle, exit_code: ^u32) -> Bool ---; + @(link_name="GetExitCodeThread") get_exit_code_thread :: proc(thread: Handle, exit_code: ^u32) -> Bool ---; + @(link_name="TerminateThread") terminate_thread :: proc(thread: Handle, exit_code: u32) -> Bool ---; @(link_name="InitializeCriticalSection") initialize_critical_section :: proc(critical_section: ^Critical_Section) ---; @(link_name="InitializeCriticalSectionAndSpinCount") initialize_critical_section_and_spin_count :: proc(critical_section: ^Critical_Section, spin_count: u32) ---; diff --git a/core/thread.odin b/core/thread.odin index 368abc204..71701a5a1 100644 --- a/core/thread.odin +++ b/core/thread.odin @@ -74,3 +74,7 @@ destroy :: proc(thread: ^Thread) { join(thread); free(thread); } + +terminate :: proc(using thread : ^Thread, exit_code : u32) { + win32.terminate_thread(win32_thread, exit_code); +} \ No newline at end of file From ffec1c77f27d87a50de540887775b0ff3e97a6be Mon Sep 17 00:00:00 2001 From: Mikkel Hjortshoej Date: Sun, 25 Feb 2018 14:38:55 +0100 Subject: [PATCH 2/2] Added terminate_thread to thread.odin --- core/sys/windows.odin | 3 ++- core/thread.odin | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/sys/windows.odin b/core/sys/windows.odin index 54a4c3705..40abc8f8c 100644 --- a/core/sys/windows.odin +++ b/core/sys/windows.odin @@ -681,7 +681,8 @@ foreign kernel32 { @(link_name="ResumeThread") resume_thread :: proc(thread: Handle) -> u32 ---; @(link_name="GetThreadPriority") get_thread_priority :: proc(thread: Handle) -> i32 ---; @(link_name="SetThreadPriority") set_thread_priority :: proc(thread: Handle, priority: i32) -> Bool ---; - @(link_name="GetExitCodeThread") get_exit_code_thread :: proc(thread: Handle, exit_code: ^u32) -> Bool ---; + @(link_name="GetExitCodeThread") get_exit_code_thread :: proc(thread: Handle, exit_code: ^u32) -> Bool ---; + @(link_name="TerminateThread") terminate_thread :: proc(thread: Handle, exit_code: u32) -> Bool ---; @(link_name="InitializeCriticalSection") initialize_critical_section :: proc(critical_section: ^Critical_Section) ---; @(link_name="InitializeCriticalSectionAndSpinCount") initialize_critical_section_and_spin_count :: proc(critical_section: ^Critical_Section, spin_count: u32) ---; diff --git a/core/thread.odin b/core/thread.odin index 368abc204..71701a5a1 100644 --- a/core/thread.odin +++ b/core/thread.odin @@ -74,3 +74,7 @@ destroy :: proc(thread: ^Thread) { join(thread); free(thread); } + +terminate :: proc(using thread : ^Thread, exit_code : u32) { + win32.terminate_thread(win32_thread, exit_code); +} \ No newline at end of file