From f4c338c63f3456a8eccd56c35e233843687d55be Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 29 Mar 2019 00:43:25 +0800 Subject: *thread --- .../asura-lib-utils/threading/binding/_thread.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source/libs/asura-lib-utils/threading/binding/_thread.cpp') 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(1); +#if ASURA_THREAD_WIN32 + ::Sleep(ms); +#elif ASURA_THREAD_STD + +#endif return 0; } -- cgit v1.1-26-g67d0