aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/thread.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/thread.c b/src/thread.c
index 1964ad6..add1287 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -288,33 +288,31 @@ int _thread_clean(lua_State* L){
return 0;
}
-
-int _thread_close(lua_State* L){
-#ifdef SUPPORTS_PTHREAD_CANCEL
-
+int _thread_kill(lua_State* L){
lua_pushstring(L, "_");
lua_gettable(L, 1);
struct thread_info* info = lua_touserdata(L, -1);
- if(info->tid != 0) pthread_cancel(info->tid);
+ if(info->tid != 0) pthread_kill(info->tid, SIGUSR1);
info->tid = 0;
return 0;
-#else
- return _thread_kill(L);
-#endif
}
+int _thread_close(lua_State* L){
+#ifdef SUPPORTS_PTHREAD_CANCEL
-int _thread_kill(lua_State* L){
lua_pushstring(L, "_");
lua_gettable(L, 1);
struct thread_info* info = lua_touserdata(L, -1);
- if(info->tid != 0) pthread_kill(info->tid, SIGUSR1);
+ if(info->tid != 0) pthread_cancel(info->tid);
info->tid = 0;
return 0;
+#else
+ return _thread_kill(L);
+#endif
}
int l_async(lua_State* oL){