From 8743ab21f74506a4316d11c61c737d6687ec469a Mon Sep 17 00:00:00 2001 From: mihacooper Date: Thu, 19 Jan 2017 01:32:29 +0300 Subject: [PATCH 1/4] update api, implement thread function arguments (so far) --- lua-api/woofer.lua | 15 ++--- src/lua-module.cpp | 42 ++++++++++++++ src/shared-table.h | 4 +- src/stored-object.cpp | 38 +----------- src/stored-object.h | 49 ++++++++++++++-- src/threading.cpp | 126 ++++++++++++++++------------------------ src/threading.h | 26 +++++++++ tests/smoke_test.lua | 132 +++++++++++++++--------------------------- 8 files changed, 216 insertions(+), 216 deletions(-) create mode 100644 src/lua-module.cpp create mode 100644 src/threading.h diff --git a/lua-api/woofer.lua b/lua-api/woofer.lua index 625fc5e..cbf9e3c 100644 --- a/lua-api/woofer.lua +++ b/lua-api/woofer.lua @@ -1,11 +1,6 @@ --local thr = require('libbevy') -package.cpath = package.cpath .. ";./?.dylib" -require('libwoofer') -local thr = thread -return { - new = function(func) - local str_func = ("%q"):format(string.dump(func)) - return thr.new(str_func) - end, - thread_id = thr.thread_id -} +package.cpath = package.cpath .. ";./?.dylib" -- MAC OS support +local api = require('libwoofer') +api.thread.thread_id = nil +api.thread.join = nil +return api \ No newline at end of file diff --git a/src/lua-module.cpp b/src/lua-module.cpp new file mode 100644 index 0000000..33a70df --- /dev/null +++ b/src/lua-module.cpp @@ -0,0 +1,42 @@ +extern "C" +{ +#include "lua.h" +#include "lauxlib.h" +#include "lualib.h" +} + +#include "threading.h" +#include "shared-table.h" + +sol::table core::init_state(sol::state_view& lua) +{ + sol::usertype thread_api( + sol::call_construction(), sol::constructors>(), + "join", &LuaThread::join, + "thread_id", &LuaThread::thread_id + ); + sol::stack::push(lua, thread_api); + auto thread_obj = sol::stack::pop(lua); + + sol::usertype share_api( + sol::call_construction(), sol::default_constructor, + sol::meta_function::new_index, &core::SharedTable::luaSet, + sol::meta_function::index, &core::SharedTable::luaGet + ); + sol::stack::push(lua, share_api); + auto share_obj = sol::stack::pop(lua); + + sol::table public_api = lua.create_table_with( + "thread", thread_obj, + "share", share_obj + ); + return public_api; +} + +extern "C" int luaopen_libwoofer(lua_State *L) +{ + sol::state_view lua(L); + sol::stack::push(lua, core::init_state(lua)); + return 1; +} + diff --git a/src/shared-table.h b/src/shared-table.h index e8bc3d5..c640f19 100644 --- a/src/shared-table.h +++ b/src/shared-table.h @@ -11,6 +11,8 @@ namespace core { +sol::table init_state(sol::state_view& lua); + class SharedTable { public: SharedTable() = default; @@ -50,4 +52,4 @@ private: TablePool& defaultPool() noexcept; -} // core \ No newline at end of file +} // core diff --git a/src/stored-object.cpp b/src/stored-object.cpp index 2e695b7..b72ddde 100644 --- a/src/stored-object.cpp +++ b/src/stored-object.cpp @@ -4,22 +4,11 @@ #include #include -#include #include -#define ERROR std::cerr - namespace core { -FunctionHolder::FunctionHolder(sol::stack_object luaObject) noexcept { - sol::state_view lua(luaObject.lua_state()); - sol::function dumper = lua["string"]["dump"]; - - assert(dumper.valid()); - function_ = dumper(luaObject); -} - bool FunctionHolder::rawCompare(const BaseHolder* other) const noexcept { return function_ == static_cast(other)->function_; } @@ -49,31 +38,6 @@ sol::object FunctionHolder::unpack(sol::this_state state) const noexcept { StoredObject::StoredObject(StoredObject&& init) noexcept : data_(std::move(init.data_)) {} -StoredObject::StoredObject(sol::stack_object luaObject) noexcept - : data_(nullptr) { - switch(luaObject.get_type()) { - case sol::type::nil: - break; - case sol::type::boolean: - data_.reset(new PrimitiveHolder(luaObject)); - break; - case sol::type::number: - data_.reset(new PrimitiveHolder(luaObject)); - break; - case sol::type::string: - data_.reset(new PrimitiveHolder(luaObject)); - break; - case sol::type::userdata: - data_.reset(new PrimitiveHolder(luaObject)); - break; - case sol::type::function: - data_.reset(new FunctionHolder(luaObject)); - break; - default: - ERROR << "Unable to store object of that type: " << (int)luaObject.get_type() << std::endl; - } -} - StoredObject::operator bool() const noexcept { return (bool)data_; } @@ -115,4 +79,4 @@ bool StoredObject::operator<(const StoredObject& o) const noexcept { return data_.get() < o.data_.get(); } -} // core \ No newline at end of file +} // core diff --git a/src/stored-object.h b/src/stored-object.h index 9897171..60bc5a4 100644 --- a/src/stored-object.h +++ b/src/stored-object.h @@ -3,9 +3,12 @@ #include #include +#include namespace core { +#define ERROR std::cerr + class BaseHolder { public: BaseHolder() noexcept : type_(sol::type::nil) {} @@ -41,8 +44,10 @@ template class PrimitiveHolder : public BaseHolder { public: PrimitiveHolder(sol::stack_object luaObject) noexcept - : data_(luaObject.as()) { - } + : data_(luaObject.as()) {} + + PrimitiveHolder(sol::object luaObject) noexcept + : data_(luaObject.as()) {} PrimitiveHolder(const StoredType& init) noexcept : data_(init) {} @@ -71,7 +76,15 @@ private: class FunctionHolder : public BaseHolder { public: - FunctionHolder(sol::stack_object luaObject) noexcept; + template + FunctionHolder(SolObject luaObject) noexcept { + sol::state_view lua(luaObject.lua_state()); + sol::function dumper = lua["string"]["dump"]; + + assert(dumper.valid()); + function_ = dumper(luaObject); + } + bool rawCompare(const BaseHolder* other) const noexcept final; bool rawLess(const BaseHolder* other) const noexcept final; std::size_t hash() const noexcept final; @@ -87,10 +100,34 @@ class StoredObject { public: StoredObject() = default; StoredObject(StoredObject&& init) noexcept; - StoredObject(sol::stack_object luaObject) noexcept; - //StoredObject(sol::object luaObject) noexcept; StoredObject(SharedTable*) noexcept; + template + StoredObject(SolObject luaObject) + { + switch(luaObject.get_type()) { + case sol::type::nil: + break; + case sol::type::boolean: + data_.reset(new PrimitiveHolder(luaObject)); + break; + case sol::type::number: + data_.reset(new PrimitiveHolder(luaObject)); + break; + case sol::type::string: + data_.reset(new PrimitiveHolder(luaObject)); + break; + case sol::type::userdata: + data_.reset(new PrimitiveHolder(luaObject)); + break; + case sol::type::function: + data_.reset(new FunctionHolder(luaObject)); + break; + default: + ERROR << "Unable to store object of that type: " << (int)luaObject.get_type() << std::endl; + } + } + operator bool() const noexcept; std::size_t hash() const noexcept; sol::object unpack(sol::this_state state) const noexcept; @@ -117,4 +154,4 @@ struct hash { } }; -} // std \ No newline at end of file +} // std diff --git a/src/threading.cpp b/src/threading.cpp index 5b3e799..4f33a6c 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -1,92 +1,66 @@ -extern "C" +#include "threading.h" + +LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept { -#include "lua.h" -#include "lauxlib.h" -#include "lualib.h" + // 1. Dump function to string + sol::state_view lua(function.lua_state()); + str_function_ = lua["string"]["dump"](function); + + // 2. Create new state + p_state_.reset(new sol::state); + assert(p_state_.get() != NULL); + p_state_->open_libraries( + sol::lib::base, sol::lib::string, + sol::lib::package, sol::lib::io, sol::lib::os + ); + auto thread_table = core::init_state(*p_state_); + (void)thread_table; + + // 3. Save parameters + validate_args(args); + + // 4. Run thread + p_thread_.reset(new std::thread(&LuaThread::work, this)); + assert(p_thread_.get() != NULL); } -#include -#include -#include -#include - -#include "shared-table.h" - -core::SharedTable shareTable; - -class LuaThread +LuaThread::~LuaThread() { -public: + join(); +} - LuaThread(const std::string& rawFunction) - : m_strFunction(rawFunction) +void LuaThread::validate_args(const sol::variadic_args& args) noexcept +{ + const auto end = --args.end(); + for(auto iter = args.begin(); iter != end; iter++) { - std::cout << "LuaThread" << std::endl; - m_pState.reset(new sol::state); - core::SharedTable::bind(*m_pState); - (*m_pState)["share"] = &shareTable; - assert(m_pState.get() != NULL); - m_pState->open_libraries( - sol::lib::base, sol::lib::string, - sol::lib::package, sol::lib::io, sol::lib::os - ); - m_pThread.reset(new std::thread(&LuaThread::Impl, this)); - assert(m_pThread.get() != NULL); - std::cout << "LuaThread##" << std::endl; + core::StoredObject store(iter->get()); + arguments_.push_back(store.unpack(sol::this_state{p_state_->lua_state()})); } +} - virtual ~LuaThread() +void LuaThread::join() noexcept +{ + if (p_thread_.get()) { - std::cout << "~LuaThread" << std::endl; - Join(); + p_thread_->join(); + p_thread_.reset(); } + arguments_.clear(); + if (p_state_.get()) + p_state_.reset(); +} - void Join() - { - std::cout << "Join started" << std::endl; - if (m_pThread.get()) - { - m_pThread->join(); - m_pThread.reset(); - } - if (m_pState.get()) - { - m_pState.reset(); - } - std::cout << "Join finished" << std::endl; - } +void LuaThread::work() noexcept +{ + sol::state& lua = *p_state_; + sol::function_result func = lua["loadstring"](str_function_); + func.get()(sol::as_args(arguments_)); +} -private: - void Impl() - { - std::cout << "Impl" << std::endl; - std::stringstream script; - script << "loadstring(" << m_strFunction << ")()"; - m_pState->script(script.str()); - } - - std::string m_strFunction; - std::shared_ptr m_pState; - std::shared_ptr m_pThread; -}; - -static std::string ThreadId() +std::string LuaThread::thread_id() noexcept { std::stringstream ss; - ss << std::hash()(std::this_thread::get_id()); + ss << std::this_thread::get_id(); return ss.str(); } - -extern "C" int luaopen_libwoofer(lua_State *L) -{ - sol::state_view lua(L); - lua.new_usertype("thread", - sol::constructors>(), - "join", &LuaThread::Join - ); - lua["thread"]["thread_id"] = ThreadId; - - core::SharedTable::bind(lua); - lua["share"] = &shareTable; - return 0; -} diff --git a/src/threading.h b/src/threading.h new file mode 100644 index 0000000..b0d1c62 --- /dev/null +++ b/src/threading.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include +#include + +#include "shared-table.h" + +class LuaThread +{ +public: + LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept; + virtual ~LuaThread() noexcept; + void join() noexcept; + static std::string thread_id() noexcept; + +private: + void work() noexcept; + void validate_args(const sol::variadic_args& args) noexcept; + + std::string str_function_; + std::shared_ptr p_state_; + std::shared_ptr p_thread_; + std::vector arguments_; +}; diff --git a/tests/smoke_test.lua b/tests/smoke_test.lua index 75fa632..bdbb923 100644 --- a/tests/smoke_test.lua +++ b/tests/smoke_test.lua @@ -1,95 +1,55 @@ -local thr = require('woofer') -t = thr.new( - function() - local thr = require('woofer') - print(share['key1']) - print(share['key2']) - print(share['key3']) - print(thr.thread_id()) - for i = 1, 100 do - io.write('2') - io.flush() - os.execute("sleep 0.1") +function compare(o1, o2) + if o1 == o2 then return true end + local o1Type = type(o1) + local o2Type = type(o2) + if o1Type ~= o2Type then return false end + if o1Type ~= 'table' then return false end + + local keySet = {} + for key1, value1 in pairs(o1) do + local value2 = o2[key1] + if value2 == nil or equals(value1, value2) == false then + return false end - end -) - -share['key1'] = 'val' -share['key2'] = 100500 -share['key3'] = true -print(thr.thread_id()) -for i = 1, 100 do - io.write('1') - io.flush() - os.execute("sleep 0.1") -end -t:join() - ---[[ -ppp("qwe") -t = thr.new( - function() - local thr = require('bevy') - print(("0x%x"):format(thr.thread_id())) - for i = 1, 10 do - io.write('.') - io.flush() - os.execute("sleep " .. 1) - end - end -) -print(("0x%x"):format(thr.thread_id())) - -for i = 1, 10 do - io.write(',') - io.flush() - os.execute("sleep " .. 1) -end - -t:join() - -print() -]] - ---[[ -str_foo = "" - -asd =10 -qwe = 20 -function bar() - local lala = { 40 } - function foo(a, b) - local d = asd - local l = lala[1] - lala = 10 - return function() return a + asd + b + qwe + l end + keySet[key1] = true end - print(debug.getupvalue(foo, 1)) - print(debug.getupvalue(foo, 2)) - table_print(debug.getinfo(foo)) - str_foo = string.dump(foo) + for key2, _ in pairs(o2) do + if not keySet[key2] then return false end + end + return true end -bar() +function check(left, right) + if not compare(left, right) then + print("ERROR") + end +end -foo2 = loadstring(str_foo) +----------- +-- TESTS -- +----------- +do -- Simple smoke + package.cpath = package.cpath .. ";./?.dylib" -- MAC OS support + local woofer = require('libwoofer') + local share = woofer.share() -local t = {} -setmetatable(t, - { - __index = function(self, key) - print("Call ", key) - return _ENV[key] + share["number"] = 100500 + share["string"] = "string value" + share["bool"] = true + + local thread = woofer.thread( + function(share) + share["child.number"] = share["number"] + share["child.string"] = share["string"] + share["child.bool"] = share["bool"] end, - __newindex = function(self, key, value) - print("Call ", key, value) - _ENV[key] = value - end - } -) -debug.setupvalue(foo2, 1, t) -debug.setupvalue(foo2, 2, { 99 }) -print(foo2(10, 20)()) -]] + share + ) + thread:join() + + check(share["child.number"], share["number"]) + check(share["child.string"], share["string"]) + check(share["child.bool"], share["bool"]) +end From f8da71f2f18149f7c92163037bfc70b7b217a80e Mon Sep 17 00:00:00 2001 From: mihacooper Date: Thu, 19 Jan 2017 12:49:13 +0300 Subject: [PATCH 2/4] change usertype adding to independent functions of each type --- src/lua-module.cpp | 29 +++++------------------------ src/shared-table.cpp | 18 +++++++++++------- src/shared-table.h | 7 ++----- src/spin-mutex.h | 2 +- src/stored-object.cpp | 4 ++-- src/stored-object.h | 6 +++--- src/threading.cpp | 24 +++++++++++++++++++----- src/threading.h | 6 ++++++ 8 files changed, 49 insertions(+), 47 deletions(-) diff --git a/src/lua-module.cpp b/src/lua-module.cpp index 33a70df..933e411 100644 --- a/src/lua-module.cpp +++ b/src/lua-module.cpp @@ -8,35 +8,16 @@ extern "C" #include "threading.h" #include "shared-table.h" -sol::table core::init_state(sol::state_view& lua) +extern "C" int luaopen_libwoofer(lua_State *L) { - sol::usertype thread_api( - sol::call_construction(), sol::constructors>(), - "join", &LuaThread::join, - "thread_id", &LuaThread::thread_id - ); - sol::stack::push(lua, thread_api); - auto thread_obj = sol::stack::pop(lua); - - sol::usertype share_api( - sol::call_construction(), sol::default_constructor, - sol::meta_function::new_index, &core::SharedTable::luaSet, - sol::meta_function::index, &core::SharedTable::luaGet - ); - sol::stack::push(lua, share_api); - auto share_obj = sol::stack::pop(lua); - + sol::state_view lua(L); + auto thread_obj = threading::LuaThread::get_user_type(lua); + auto share_obj = share_data::SharedTable::get_user_type(lua); sol::table public_api = lua.create_table_with( "thread", thread_obj, "share", share_obj ); - return public_api; -} - -extern "C" int luaopen_libwoofer(lua_State *L) -{ - sol::state_view lua(L); - sol::stack::push(lua, core::init_state(lua)); + sol::stack::push(lua, public_api); return 1; } diff --git a/src/shared-table.cpp b/src/shared-table.cpp index a11353b..dd85ad3 100644 --- a/src/shared-table.cpp +++ b/src/shared-table.cpp @@ -3,13 +3,17 @@ #include #include -namespace core { +namespace share_data { -void SharedTable::bind(sol::state_view& lua) noexcept { - lua.new_usertype("shared_table", - sol::meta_function::new_index, &SharedTable::luaSet, - sol::meta_function::index, &SharedTable::luaGet, - sol::meta_function::length, &SharedTable::size); +sol::object SharedTable::get_user_type(sol::state_view& lua) noexcept { + static sol::usertype type( + sol::call_construction(), sol::default_constructor, + sol::meta_function::new_index, &share_data::SharedTable::luaSet, + sol::meta_function::index, &share_data::SharedTable::luaGet, + sol::meta_function::length, &SharedTable::size + ); + sol::stack::push(lua, type); + return sol::stack::pop(lua); } void SharedTable::luaSet(sol::stack_object luaKey, sol::stack_object luaValue) noexcept { @@ -65,4 +69,4 @@ TablePool& defaultPool() noexcept { return pool; } -} // core \ No newline at end of file +} // core diff --git a/src/shared-table.h b/src/shared-table.h index c640f19..f1c9a37 100644 --- a/src/shared-table.h +++ b/src/shared-table.h @@ -9,9 +9,7 @@ #include #include -namespace core { - -sol::table init_state(sol::state_view& lua); +namespace share_data { class SharedTable { public: @@ -20,8 +18,7 @@ public: void luaSet(sol::stack_object luaKey, sol::stack_object luaValue) noexcept; sol::object luaGet(sol::stack_object key, sol::this_state state) noexcept; - // Add usertype to state - static void bind(sol::state_view& lua) noexcept; + static sol::object get_user_type(sol::state_view& lua) noexcept; private: // lau bindings size_t size() noexcept; diff --git a/src/spin-mutex.h b/src/spin-mutex.h index d497a32..f5b6537 100644 --- a/src/spin-mutex.h +++ b/src/spin-mutex.h @@ -3,7 +3,7 @@ #include #include -namespace core { +namespace share_data { class SpinMutex { public: diff --git a/src/stored-object.cpp b/src/stored-object.cpp index b72ddde..a3a05f6 100644 --- a/src/stored-object.cpp +++ b/src/stored-object.cpp @@ -7,7 +7,7 @@ #include -namespace core { +namespace share_data { bool FunctionHolder::rawCompare(const BaseHolder* other) const noexcept { return function_ == static_cast(other)->function_; @@ -79,4 +79,4 @@ bool StoredObject::operator<(const StoredObject& o) const noexcept { return data_.get() < o.data_.get(); } -} // core +} diff --git a/src/stored-object.h b/src/stored-object.h index 60bc5a4..be2ff09 100644 --- a/src/stored-object.h +++ b/src/stored-object.h @@ -5,7 +5,7 @@ #include #include -namespace core { +namespace share_data { #define ERROR std::cerr @@ -148,8 +148,8 @@ private: namespace std { template<> -struct hash { - std::size_t operator()(const core::StoredObject &object) const noexcept { +struct hash { + std::size_t operator()(const share_data::StoredObject &object) const noexcept { return object.hash(); } }; diff --git a/src/threading.cpp b/src/threading.cpp index 4f33a6c..0d91846 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -1,7 +1,8 @@ #include "threading.h" -LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept -{ +namespace threading { + +LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept{ // 1. Dump function to string sol::state_view lua(function.lua_state()); str_function_ = lua["string"]["dump"](function); @@ -13,8 +14,8 @@ LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& ar sol::lib::base, sol::lib::string, sol::lib::package, sol::lib::io, sol::lib::os ); - auto thread_table = core::init_state(*p_state_); - (void)thread_table; + get_user_type(*p_state_); + share_data::SharedTable::get_user_type(*p_state_); // 3. Save parameters validate_args(args); @@ -34,7 +35,7 @@ void LuaThread::validate_args(const sol::variadic_args& args) noexcept const auto end = --args.end(); for(auto iter = args.begin(); iter != end; iter++) { - core::StoredObject store(iter->get()); + share_data::StoredObject store(iter->get()); arguments_.push_back(store.unpack(sol::this_state{p_state_->lua_state()})); } } @@ -64,3 +65,16 @@ std::string LuaThread::thread_id() noexcept ss << std::this_thread::get_id(); return ss.str(); } + +sol::object LuaThread::get_user_type(sol::state_view& lua) noexcept +{ + static sol::usertype type( + sol::call_construction(), sol::constructors>(), + "join", &LuaThread::join, + "thread_id", &LuaThread::thread_id + ); + sol::stack::push(lua, type); + return sol::stack::pop(lua); +} + +} diff --git a/src/threading.h b/src/threading.h index b0d1c62..54df6cc 100644 --- a/src/threading.h +++ b/src/threading.h @@ -7,13 +7,17 @@ #include "shared-table.h" +namespace threading { + class LuaThread { public: LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept; virtual ~LuaThread() noexcept; void join() noexcept; + static std::string thread_id() noexcept; + static sol::object get_user_type(sol::state_view& lua) noexcept; private: void work() noexcept; @@ -24,3 +28,5 @@ private: std::shared_ptr p_thread_; std::vector arguments_; }; + +} From 5f59d008be4acefd8ce5f46dff421de538688c6d Mon Sep 17 00:00:00 2001 From: mihacooper Date: Fri, 20 Jan 2017 14:16:29 +0300 Subject: [PATCH 3/4] fixes of review comments --- src/lua-module.cpp | 7 +------ src/shared-table.cpp | 2 +- src/threading.cpp | 9 ++------- src/threading.h | 9 +++++---- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/lua-module.cpp b/src/lua-module.cpp index 933e411..5d2219c 100644 --- a/src/lua-module.cpp +++ b/src/lua-module.cpp @@ -1,9 +1,4 @@ -extern "C" -{ -#include "lua.h" -#include "lauxlib.h" -#include "lualib.h" -} +#include "lua.hpp" #include "threading.h" #include "shared-table.h" diff --git a/src/shared-table.cpp b/src/shared-table.cpp index dd85ad3..d84c812 100644 --- a/src/shared-table.cpp +++ b/src/shared-table.cpp @@ -69,4 +69,4 @@ TablePool& defaultPool() noexcept { return pool; } -} // core +} // share_data diff --git a/src/threading.cpp b/src/threading.cpp index 0d91846..f7f0962 100644 --- a/src/threading.cpp +++ b/src/threading.cpp @@ -18,19 +18,14 @@ LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& ar share_data::SharedTable::get_user_type(*p_state_); // 3. Save parameters - validate_args(args); + store_args(args); // 4. Run thread p_thread_.reset(new std::thread(&LuaThread::work, this)); assert(p_thread_.get() != NULL); } -LuaThread::~LuaThread() -{ - join(); -} - -void LuaThread::validate_args(const sol::variadic_args& args) noexcept +void LuaThread::store_args(const sol::variadic_args& args) noexcept { const auto end = --args.end(); for(auto iter = args.begin(); iter != end; iter++) diff --git a/src/threading.h b/src/threading.h index 54df6cc..d5a0be1 100644 --- a/src/threading.h +++ b/src/threading.h @@ -1,19 +1,20 @@ #pragma once +#include "shared-table.h" + #include + #include #include #include -#include "shared-table.h" - namespace threading { class LuaThread { public: LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept; - virtual ~LuaThread() noexcept; + virtual ~LuaThread() noexcept = default; void join() noexcept; static std::string thread_id() noexcept; @@ -21,7 +22,7 @@ public: private: void work() noexcept; - void validate_args(const sol::variadic_args& args) noexcept; + void store_args(const sol::variadic_args& args) noexcept; std::string str_function_; std::shared_ptr p_state_; From 52128c407842590cbdedd13483b5a926b90610e9 Mon Sep 17 00:00:00 2001 From: Ilia Date: Fri, 20 Jan 2017 16:56:35 +0300 Subject: [PATCH 4/4] Fix namespace --- src/stored-object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stored-object.h b/src/stored-object.h index be2ff09..92dd1e4 100644 --- a/src/stored-object.h +++ b/src/stored-object.h @@ -143,7 +143,7 @@ private: StoredObject& operator=(const StoredObject&) = delete; }; -} // core +} // share_data namespace std {