Crafter.Build update
This commit is contained in:
parent
24a2a69e71
commit
3924c21af1
6 changed files with 59 additions and 52 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Crafter.Thread
|
Crafter®.Thread
|
||||||
Copyright (C) 2025 Catcrafts
|
Copyright (C) 2025 Catcrafts®
|
||||||
Catcrafts.net
|
Catcrafts.net
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
|
|
@ -18,15 +18,9 @@ License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module;
|
module Crafter.Thread:ThreadPool_impl;
|
||||||
|
import std;
|
||||||
#include <thread>
|
import :ThreadPool;
|
||||||
#include <functional>
|
|
||||||
#include <mutex>
|
|
||||||
#include <print>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
module Crafter.Thread;
|
|
||||||
|
|
||||||
using namespace Crafter::Thread;
|
using namespace Crafter::Thread;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Crafter.Thread
|
Crafter®.Thread
|
||||||
Copyright (C) 2025 Catcrafts
|
Copyright (C) 2025 Catcrafts®
|
||||||
Catcrafts.net
|
Catcrafts.net
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
|
|
@ -18,15 +18,8 @@ License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module;
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <functional>
|
|
||||||
#include <atomic>
|
|
||||||
#include <thread>
|
|
||||||
#include <condition_variable>
|
|
||||||
|
|
||||||
export module Crafter.Thread:ThreadPool;
|
export module Crafter.Thread:ThreadPool;
|
||||||
|
import std;
|
||||||
|
|
||||||
namespace Crafter::Thread {
|
namespace Crafter::Thread {
|
||||||
struct ThreadStorage {
|
struct ThreadStorage {
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Crafter.Thread
|
Crafter®.Thread
|
||||||
Copyright (C) 2025 Catcrafts
|
Copyright (C) 2025 Catcrafts®
|
||||||
Catcrafts.net
|
Catcrafts.net
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
|
|
@ -19,5 +19,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export module Crafter.Thread;
|
export module Crafter.Thread;
|
||||||
|
|
||||||
export import :ThreadPool;
|
export import :ThreadPool;
|
||||||
10
main.cpp
10
main.cpp
|
|
@ -1,10 +0,0 @@
|
||||||
#include <print>
|
|
||||||
|
|
||||||
import Crafter.Thread;
|
|
||||||
using namespace Crafter::Thread;
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
ThreadPool::Start(3);
|
|
||||||
ThreadPool::Enqueue({[](){std::println("1");}, [](){std::println("2");}, [](){std::println("3");}, [](){std::println("4");}, [](){std::println("5");},[](){std::println("6");}, [](){std::println("7");}, [](){std::println("8");}, [](){std::println("9");}, [](){std::println("10");}});
|
|
||||||
ThreadPool::Stop();
|
|
||||||
}
|
|
||||||
38
project.json
38
project.json
|
|
@ -2,30 +2,32 @@
|
||||||
"name": "crafter-thread",
|
"name": "crafter-thread",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "base",
|
"name": "lib",
|
||||||
"standard": "c++26",
|
"interfaces": ["interfaces/Crafter.Thread", "interfaces/Crafter.Thread-ThreadPool"],
|
||||||
"source_files": ["Crafter.Thread-ThreadPool"],
|
"implementations": ["implementations/Crafter.Thread-ThreadPool"],
|
||||||
"module_files": ["Crafter.Thread", "Crafter.Thread-ThreadPool"],
|
|
||||||
"additional_files": [],
|
|
||||||
"build_dir": "build",
|
|
||||||
"output_dir": "bin",
|
|
||||||
"type":"library"
|
"type":"library"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "lib-shared",
|
||||||
|
"extends": ["lib"],
|
||||||
|
"type":"shared-library"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "lib-debug",
|
"name": "lib-debug",
|
||||||
"extends": ["base"],
|
"extends": ["lib"],
|
||||||
"debug": true
|
"debug": true
|
||||||
},
|
}
|
||||||
|
],
|
||||||
|
"tests":[
|
||||||
{
|
{
|
||||||
"name": "lib-release",
|
"name": "should-compile",
|
||||||
"extends": ["base"],
|
"implementations": ["tests/ShouldCompile/ShouldCompile"],
|
||||||
"optimization_level": "3"
|
"dependencies": [
|
||||||
},
|
{
|
||||||
{
|
"path":"./project.json",
|
||||||
"name": "develop",
|
"configuration":"lib-shared"
|
||||||
"source_files": ["main"],
|
}
|
||||||
"extends": ["lib-debug"],
|
]
|
||||||
"type":"executable"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
29
tests/ShouldCompile/ShouldCompile.cpp
Normal file
29
tests/ShouldCompile/ShouldCompile.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
Crafter® Build
|
||||||
|
Copyright (C) 2025 Catcrafts®
|
||||||
|
Catcrafts.net
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License version 3.0 as published by the Free Software Foundation;
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
import Crafter.Thread;
|
||||||
|
import std;
|
||||||
|
using namespace Crafter;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
std::string* RunTest() {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue