diff options
Diffstat (limited to 'src/llthread.c')
-rw-r--r-- | src/llthread.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/llthread.c b/src/llthread.c index 0ffa727..33eab4f 100644 --- a/src/llthread.c +++ b/src/llthread.c | |||
@@ -4,8 +4,8 @@ | |||
4 | 4 | ||
5 | #define LLTHREAD_VERSION_MAJOR 0 | 5 | #define LLTHREAD_VERSION_MAJOR 0 |
6 | #define LLTHREAD_VERSION_MINOR 1 | 6 | #define LLTHREAD_VERSION_MINOR 1 |
7 | #define LLTHREAD_VERSION_PATCH 0 | 7 | #define LLTHREAD_VERSION_PATCH 2 |
8 | #define LLTHREAD_VERSION_COMMENT "" | 8 | #define LLTHREAD_VERSION_COMMENT "dev" |
9 | 9 | ||
10 | #ifndef USE_PTHREAD | 10 | #ifndef USE_PTHREAD |
11 | # include <windows.h> | 11 | # include <windows.h> |
@@ -660,6 +660,24 @@ static int l_llthread_alive(lua_State *L) { | |||
660 | 660 | ||
661 | } | 661 | } |
662 | 662 | ||
663 | static int l_llthread_started(lua_State *L) { | ||
664 | llthread_t *this = l_llthread_at(L, 1); | ||
665 | lua_pushboolean(L, IS(this, STARTED)?1:0); | ||
666 | return 1; | ||
667 | } | ||
668 | |||
669 | static int l_llthread_detached(lua_State *L) { | ||
670 | llthread_t *this = l_llthread_at(L, 1); | ||
671 | lua_pushboolean(L, IS(this, DETACHED)?1:0); | ||
672 | return 1; | ||
673 | } | ||
674 | |||
675 | static int l_llthread_joinable(lua_State *L) { | ||
676 | llthread_t *this = l_llthread_at(L, 1); | ||
677 | lua_pushboolean(L, IS(this, JOINABLE)?1:0); | ||
678 | return 1; | ||
679 | } | ||
680 | |||
663 | static int l_llthread_new(lua_State *L) { | 681 | static int l_llthread_new(lua_State *L) { |
664 | size_t lua_code_len; const char *lua_code = luaL_checklstring(L, 1, &lua_code_len); | 682 | size_t lua_code_len; const char *lua_code = luaL_checklstring(L, 1, &lua_code_len); |
665 | llthread_t **this = lutil_newudatap(L, llthread_t*, LLTHREAD_TAG); | 683 | llthread_t **this = lutil_newudatap(L, llthread_t*, LLTHREAD_TAG); |
@@ -674,6 +692,9 @@ static const struct luaL_Reg l_llthread_meth[] = { | |||
674 | {"start", l_llthread_start }, | 692 | {"start", l_llthread_start }, |
675 | {"join", l_llthread_join }, | 693 | {"join", l_llthread_join }, |
676 | {"alive", l_llthread_alive }, | 694 | {"alive", l_llthread_alive }, |
695 | {"started", l_llthread_started }, | ||
696 | {"detached", l_llthread_detached }, | ||
697 | {"joinable", l_llthread_joinable }, | ||
677 | {"__gc", l_llthread_delete }, | 698 | {"__gc", l_llthread_delete }, |
678 | 699 | ||
679 | {NULL, NULL} | 700 | {NULL, NULL} |