Browse Source

Merge branch 'master' of https://github.com/odin-lang/Odin

gingerBill 7 years ago
parent
commit
ae9da0abfb
2 changed files with 6 additions and 1 deletions
  1. 2 1
      core/sys/windows.odin
  2. 4 0
      core/thread.odin

+ 2 - 1
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) ---;

+ 4 - 0
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);
+}