summaryrefslogtreecommitdiff
path: root/source/libs/asura-lib-utils/threading/binding/_thread.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-29 00:43:25 +0800
committerchai <chaifix@163.com>2019-03-29 00:43:25 +0800
commitf4c338c63f3456a8eccd56c35e233843687d55be (patch)
tree7278fe4723320c9ef310c5a04d92bf0be1bc778c /source/libs/asura-lib-utils/threading/binding/_thread.cpp
parent3bced067a4144381e59ce4bd0eb749eeff5ad1f4 (diff)
*thread
Diffstat (limited to 'source/libs/asura-lib-utils/threading/binding/_thread.cpp')
-rw-r--r--source/libs/asura-lib-utils/threading/binding/_thread.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/libs/asura-lib-utils/threading/binding/_thread.cpp b/source/libs/asura-lib-utils/threading/binding/_thread.cpp
index 00252a9..9403486 100644
--- a/source/libs/asura-lib-utils/threading/binding/_thread.cpp
+++ b/source/libs/asura-lib-utils/threading/binding/_thread.cpp
@@ -18,7 +18,8 @@ namespace AsuraEngine
{ "AddTask", _AddTask },
{ "IsRunning", _IsRunning },
{ "IsCurrent", _IsCurrent },
- { "GetName", _GetName }
+ { "GetName", _GetName },
+ { "Sleep", _Sleep }
);
}
@@ -81,7 +82,7 @@ namespace AsuraEngine
LUAX_PREPARE(L, Thread);
state.Push(self->IsRunning());
- return 0;
+ return 1;
}
// thread:IsCurrent()
@@ -90,7 +91,7 @@ namespace AsuraEngine
LUAX_PREPARE(L, Thread);
state.Push(self->IsCurrent());
- return 0;
+ return 1;
}
// thread:GetName()
@@ -98,6 +99,20 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Thread);
+ state.Push(self->GetName());
+ return 1;
+ }
+
+ // Thread.Sleep(milliseconds)
+ LUAX_IMPL_METHOD(Thread, _Sleep)
+ {
+ LUAX_STATE(L);
+ int ms = state.CheckValue<int>(1);
+#if ASURA_THREAD_WIN32
+ ::Sleep(ms);
+#elif ASURA_THREAD_STD
+
+#endif
return 0;
}