From f772f49c8786750a84cf00c620c7445bc5d0bb3d Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 24 May 2020 10:42:29 +0200 Subject: [PATCH] Initial commit. --- .gitignore | 8 ++++++++ LICENSE | 19 +++++++++++++++++++ README.md | 3 +++ SCsub | 29 +++++++++++++++++++++++++++++ config.py | 39 +++++++++++++++++++++++++++++++++++++++ register_types.cpp | 34 ++++++++++++++++++++++++++++++++++ register_types.h | 32 ++++++++++++++++++++++++++++++++ thread_pool.cpp | 34 ++++++++++++++++++++++++++++++++++ thread_pool.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 241 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 SCsub create mode 100644 config.py create mode 100644 register_types.cpp create mode 100644 register_types.h create mode 100644 thread_pool.cpp create mode 100644 thread_pool.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7001be7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.import +*.d +*.o +*.meta +*.obj +*.pyc +*.bc +*.os \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..190891a --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020 Péter Magyar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..51493eb --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ThreadPool + +A c++ Godot engine module, that will help you with threading. \ No newline at end of file diff --git a/SCsub b/SCsub new file mode 100644 index 0000000..2096dc2 --- /dev/null +++ b/SCsub @@ -0,0 +1,29 @@ +import os + +Import('env') + +module_env = env.Clone() + +#Should work with just arrays +#if os.path.isdir('../mesh_data_resource'): +# module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT']) + +sources = [ + + "register_types.cpp", + + "fast_quadratic_mesh_simplifier.cpp", +] + +if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': + # Shared lib compilation + module_env.Append(CCFLAGS=['-fPIC']) + module_env['LIBS'] = [] + shared_lib = module_env.SharedLibrary(target='#bin/thread_pool', source=sources) + shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0] + env.Append(LIBS=[shared_lib_shim]) + env.Append(LIBPATH=['#bin']) +else: + # Static compilation + module_env.add_source_files(env.modules_sources, sources) + diff --git a/config.py b/config.py new file mode 100644 index 0000000..86c02f2 --- /dev/null +++ b/config.py @@ -0,0 +1,39 @@ + +# Copyright (c) 2020 Péter Magyar + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + + +def can_build(env, platform): + return True + + +def configure(env): + pass + + +def get_doc_classes(): + return [ + "", + ] + +def get_doc_path(): + return "doc_classes" + diff --git a/register_types.cpp b/register_types.cpp new file mode 100644 index 0000000..867833b --- /dev/null +++ b/register_types.cpp @@ -0,0 +1,34 @@ +#include "register_types.h" + +#include "thread_pool.h" + +/* + +Copyright (c) 2020 Péter Magyar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +void register_thread_pool_types() { + ClassDB::register_class(); +} + +void unregister_thread_pool_types() { +} diff --git a/register_types.h b/register_types.h new file mode 100644 index 0000000..c2542e2 --- /dev/null +++ b/register_types.h @@ -0,0 +1,32 @@ +#ifndef THREAD_POOL_REGISTER_TYPES_H +#define THREAD_POOL_REGISTER_TYPES_H + +/* + +Copyright (c) 2020 Péter Magyar +Copyright(c) 2017-2020 Mattias Edlund + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +void register_thread_pool_types(); +void unregister_thread_pool_types(); + +#endif diff --git a/thread_pool.cpp b/thread_pool.cpp new file mode 100644 index 0000000..fd5a28e --- /dev/null +++ b/thread_pool.cpp @@ -0,0 +1,34 @@ +#include "thread_pool.h" + +/* + +Copyright (c) 2020 Péter Magyar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +ThreadPool::ThreadPool() { +} + +ThreadPool::~ThreadPool() { +} + +void ThreadPool::_bind_methods() { +} diff --git a/thread_pool.h b/thread_pool.h new file mode 100644 index 0000000..6b5683a --- /dev/null +++ b/thread_pool.h @@ -0,0 +1,43 @@ +#ifndef THREAD_POOL_H +#define THREAD_POOL_H + +/* + +Copyright (c) 2020 Péter Magyar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +#include "core/object.h" + +class ThreadPool : public Object { + GDCLASS(ThreadPool, Object); + +public: + ThreadPool(); + ~ThreadPool(); + +protected: + static void _bind_methods(); + +private: +}; + +#endif