rename project to Effil

This commit is contained in:
mihacooper 2017-01-22 19:30:40 +03:00
parent 797df10e29
commit daefaf979b
12 changed files with 39 additions and 39 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8)
project(woofer)
project(effil)
find_package(Lua REQUIRED)
@ -18,13 +18,13 @@ if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
endif()
add_library(woofer SHARED ${SOURCES})
target_link_libraries(woofer -lpthread ${LUA_LIBRARY})
add_library(effil SHARED ${SOURCES})
target_link_libraries(effil -lpthread ${LUA_LIBRARY})
set(GENERAL "-std=c++14 -pthread")
set(ENABLE_WARNINGS "-Wall -Wextra -pedantic -Werror")
set(BUILD_FLAVOR "-O3 -UNDEBUG")
set_target_properties(woofer PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENERAL} ${BUILD_FLAVOR}")
set_target_properties(effil PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENERAL} ${BUILD_FLAVOR}")
#----------
# TESTS ---
@ -35,7 +35,7 @@ set(GTEST_DIR tests/gtest/googletest)
include_directories(${GTEST_DIR}/include ${GTEST_DIR})
add_executable(tests ${TEST_SOURCES} ${GTEST_DIR}/src/gtest-all.cc)
target_link_libraries(tests woofer)
target_link_libraries(tests effil)
set_target_properties(tests PROPERTIES COMPILE_FLAGS "${ENABLE_WARNINGS} ${GENERAL} ${BUILD_FLAVOR}")

View File

@ -1,4 +1,4 @@
# Woofer
# Effil
Threading library for Lua. Written in C++ with great help of [sol2](https://github.com/ThePhD/sol2).
[![Build Status](https://travis-ci.org/loud-hound/woofer.svg?branch=master)](https://travis-ci.org/loud-hound/woofer)

View File

@ -1,15 +1,15 @@
TestSmoke = {}
function TestSmoke:testGeneralWorkability()
local woofer = require('libwoofer')
local share = woofer.share()
local effil = require('libeffil')
local share = effil.share()
share["number"] = 100500
share["string"] = "string value"
share["bool"] = true
log "Start thread"
local thread = woofer.thread(
local thread = effil.thread(
function(share)
share["child.number"] = share["number"]
share["child.string"] = share["string"]
@ -30,12 +30,12 @@ function TestSmoke:testGeneralWorkability()
end
function TestSmoke:testDetach()
local woofer = require('libwoofer')
local share = woofer.share()
local effil = require('libeffil')
local share = effil.share()
share["finished"] = false
log "Start thread"
local thread = woofer.thread(
local thread = effil.thread(
function(share)
local startTime = os.time()
while ( (os.time() - startTime) <= 3) do --[[ Like we are working 3sec ... ]] end

View File

@ -6,19 +6,19 @@
namespace {
static sol::object createThread(sol::this_state lua, sol::function func, const sol::variadic_args &args) noexcept {
return sol::make_object(lua, std::make_unique<threading::LuaThread>(func, args));
return sol::make_object(lua, std::make_unique<effil::LuaThread>(func, args));
}
static sol::object createShare(sol::this_state lua) noexcept {
return sol::make_object(lua, std::make_unique<share_data::SharedTable>());
return sol::make_object(lua, std::make_unique<effil::SharedTable>());
}
} // namespace
extern "C" int luaopen_libwoofer(lua_State *L) {
extern "C" int luaopen_libeffil(lua_State *L) {
sol::state_view lua(L);
threading::LuaThread::getUserType(lua);
share_data::SharedTable::getUserType(lua);
effil::LuaThread::getUserType(lua);
effil::SharedTable::getUserType(lua);
sol::table public_api = lua.create_table_with(
"thread", createThread,
"share", createShare

View File

@ -3,13 +3,13 @@
#include <cassert>
#include <mutex>
namespace share_data {
namespace effil {
sol::object SharedTable::getUserType(sol::state_view &lua) noexcept {
static sol::usertype<share_data::SharedTable> type(
static sol::usertype<SharedTable> 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::new_index, &SharedTable::luaSet,
sol::meta_function::index, &SharedTable::luaGet,
sol::meta_function::length, &SharedTable::size
);
sol::stack::push(lua, type);
@ -75,4 +75,4 @@ TablePool& defaultPool() noexcept {
return pool;
}
} // share_data
} // effil

View File

@ -9,7 +9,7 @@
#include <memory>
#include <vector>
namespace share_data {
namespace effil {
class SharedTable {
public:
@ -50,4 +50,4 @@ private:
TablePool& defaultPool() noexcept;
} // share_data
} // effil

View File

@ -3,7 +3,7 @@
#include <atomic>
#include <thread>
namespace share_data {
namespace effil {
class SpinMutex {
public:
@ -21,4 +21,4 @@ private:
std::atomic_flag lock_ = ATOMIC_FLAG_INIT;
};
} // share_data
} // effil

View File

@ -9,7 +9,7 @@
#include <cassert>
namespace share_data {
namespace effil {
namespace {
@ -211,4 +211,4 @@ bool StoredObject::operator<(const StoredObject& o) const noexcept {
return data_.get() < o.data_.get();
}
} // share_data
} // effil

View File

@ -5,7 +5,7 @@
#include <utility>
#include <iostream>
namespace share_data {
namespace effil {
class BaseHolder {
public:
@ -63,14 +63,14 @@ private:
StoredObject& operator=(const StoredObject&) = delete;
};
} // share_data
} // effil
namespace std {
// For storing as key in std::unordered_map
template<>
struct hash<share_data::StoredObject> {
std::size_t operator()(const share_data::StoredObject &object) const noexcept {
struct hash<effil::StoredObject> {
std::size_t operator()(const effil::StoredObject &object) const noexcept {
return object.hash();
}
};

View File

@ -1,6 +1,6 @@
#include "threading.h"
namespace threading {
namespace effil {
LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& args) noexcept {
// 1. Dump function to string
@ -15,7 +15,7 @@ LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& ar
sol::lib::package, sol::lib::io, sol::lib::os
);
getUserType(*p_state_);
share_data::SharedTable::getUserType(*p_state_);
effil::SharedTable::getUserType(*p_state_);
// 3. Save parameters
storeArgs(args);
@ -28,7 +28,7 @@ LuaThread::LuaThread(const sol::function& function, const sol::variadic_args& ar
void LuaThread::storeArgs(const sol::variadic_args &args) noexcept {
p_arguments_ = std::make_shared<std::vector<sol::object>>();
for(auto iter = args.begin(); iter != args.end(); iter++) {
share_data::StoredObject store(iter->get<sol::object>());
effil::StoredObject store(iter->get<sol::object>());
p_arguments_->push_back(store.unpack(sol::this_state{p_state_->lua_state()}));
}
}
@ -78,4 +78,4 @@ sol::object LuaThread::getUserType(sol::state_view &lua) noexcept
return sol::stack::pop<sol::object>(lua);
}
} // threading
} // effil

View File

@ -8,7 +8,7 @@
#include <sstream>
#include <thread>
namespace threading {
namespace effil {
class LuaThread {
public:
@ -30,4 +30,4 @@ private:
std::shared_ptr<std::vector<sol::object>> p_arguments_;
};
} // threading
} // effil

View File

@ -4,7 +4,7 @@
#include <thread>
using namespace share_data;
using namespace effil;
namespace {