Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Thread result can be only pointer now. | 645f6ce75c773fd2fad543bfd542202d02925288 | Jackalope | 2020-05-26 14:19:11 |
Option JLIB_STATIC to select static or shared library. | 08b3a60286a7487ce445f66852f0afdd0f99be69 | Jackalope | 2020-05-26 14:17:11 |
Add warning compilation flags. | 071b3c83090367f7c2beea5394b926c14620dc66 | Jackalope | 2020-05-26 13:25:37 |
New thread pool implementation. | 849910e5b45ab543231e24650368289a180452d6 | Jackalope | 2020-05-26 08:59:03 |
rarray::iterator_index function | 7ee95c6b048973f209fc4e365af36a3dcdb06c4b | Jackalope | 2020-05-26 08:58:20 |
darray::remove_last_if_exist logic fix | 1664bbfba9d4d8098542c8138a548e4377304aa6 | Jackalope | 2020-05-26 08:55:31 |
remove float convertion warning | 1ea4783034b873f7711e2ecf840955818c07bcd0 | Jackalope | 2020-05-26 08:54:04 |
threads refactoring | 9b03fd0beb928de9f3f3e492bb1d324356152de3 | Jackalope | 2020-05-26 08:52:26 |
changed notice about native compilation | 7b48919f0f46df08f14c8a867d7d1c5d14c19efb | Jackalope | 2020-05-24 16:37:16 |
remove LTO option | a95b60656c6c00d64efd769d5047853315964556 | Jackalope | 2020-05-24 13:39:59 |
compiler options and optimizations | 92bc2d91c14c58ce630a7f4f400b5d076ac03286 | Jackalope | 2020-05-24 01:16:59 |
cpu_number return unsigned int | b9c11a1b4474747c313957bef5573d1db6c481ff | Jackalope | 2020-05-24 00:13:29 |
ThreadPool moved to jl namespace, same for cpu_number function | 2e486f0d57347197a875abe79b4c637e7c925ecc | Jackalope | 2020-05-23 23:26:00 |
removed inline keyword from functions in fs.cpp | 295f11fb3a3f285c5393687675d8dd2c86e726b8 | Jackalope | 2020-05-23 23:25:12 |
make assert constexpr compatible again | 378556f2203439749e7c4003031c3e1de1511f6d | Jackalope | 2020-05-23 23:24:04 |
renamed Doxygen options | cbda01d11706d12d842d088e917dd3e7866689a2 | Jackalope | 2020-05-23 23:23:30 |
Updated license notice | 0d013874b3eca0e34ad14cbb4dc4aa7628549a4b | Jackalope | 2020-05-23 22:52:50 |
Moved some implementation to library obj target | 43b7241f3ded0b0b049d15bf337dac6b25b577e6 | Jackalope | 2020-05-23 22:44:45 |
CMake documentation target | 8ab15abc55ba97919ffa4b07bdf9389b0ff57a24 | Jackalope | 2020-05-23 21:19:36 |
CMake install target with version control | 9e7aaf56c9c3cae628cc8dc35ded5fec49d414b2 | Jackalope | 2020-05-23 21:10:32 |
File | Lines added | Lines deleted |
---|---|---|
include/jlib/threads/def.h | 1 | 5 |
include/jlib/threads/impl_pthreads.inl | 1 | 1 |
src/thread_pool.cpp | 3 | 3 |
src/thread_pool_2.cpp | 3 | 3 |
File include/jlib/threads/def.h changed (mode: 100644) (index e057f47..f89a82e) | |||
... | ... | struct jl::threads::condition_t { | |
65 | 65 | }; | }; |
66 | 66 | template<typename result_t> | template<typename result_t> |
67 | 67 | struct jl::threads::thread_decl { | struct jl::threads::thread_decl { |
68 | static_assert(not std::is_void<result_t>::value | ||
69 | and | ||
70 | (std::is_pointer<result_t>::value | ||
71 | or | ||
72 | sizeof (result_t) <= sizeof (void*))); | ||
68 | static_assert(std::is_pointer<result_t>::value); | ||
73 | 69 | template <typename arg, result_t func(arg*)> | template <typename arg, result_t func(arg*)> |
74 | 70 | [[nodiscard]] bool | [[nodiscard]] bool |
75 | 71 | run_deteached(arg *p_arg); | run_deteached(arg *p_arg); |
File include/jlib/threads/impl_pthreads.inl changed (mode: 100644) (index 39f26ae..c0ed191) | |||
... | ... | struct jl::threads::thread_t<pthread_t, result_t> : thread_decl<result_t> | |
227 | 227 | join() { | join() { |
228 | 228 | void *res; | void *res; |
229 | 229 | check::pthread_join(pthread_join(m, &res)); | check::pthread_join(pthread_join(m, &res)); |
230 | return static_cast<result_t>(reinterpret_cast<intptr_t>(res)); | ||
230 | return reinterpret_cast<result_t>(res); | ||
231 | 231 | } | } |
232 | 232 | void | void |
233 | 233 | deteach() { | deteach() { |
File src/thread_pool.cpp changed (mode: 100644) (index efd882f..668fa40) | |||
... | ... | struct TaskQueueSequential { | |
55 | 55 | }; | }; |
56 | 56 | struct ThreadData { | struct ThreadData { |
57 | 57 | ThreadPool::Data *p_data; | ThreadPool::Data *p_data; |
58 | Thread<int> instance; | ||
58 | Thread<void*> instance; | ||
59 | 59 | bool is_dead; | bool is_dead; |
60 | 60 | }; | }; |
61 | 61 | struct jl::ThreadPool::Data { | struct jl::ThreadPool::Data { |
... | ... | queue_st_resolve(TaskQueueSequential *p, TaskQueues *p_queues) { | |
216 | 216 | } | } |
217 | 217 | p->tasks_lock.unlock(); | p->tasks_lock.unlock(); |
218 | 218 | } | } |
219 | static int | ||
219 | static void* | ||
220 | 220 | thread_loop(ThreadData *p_td) { | thread_loop(ThreadData *p_td) { |
221 | 221 | const auto &p_data = p_td->p_data; | const auto &p_data = p_td->p_data; |
222 | 222 | auto &task_queues = p_data->task_queues; | auto &task_queues = p_data->task_queues; |
... | ... | thread_loop(ThreadData *p_td) { | |
235 | 235 | queue_st_resolve(&stask_queue, &task_queues); | queue_st_resolve(&stask_queue, &task_queues); |
236 | 236 | } | } |
237 | 237 | p_td->is_dead = true; | p_td->is_dead = true; |
238 | return 0; | ||
238 | return nullptr; | ||
239 | 239 | } | } |
240 | 240 | [[nodiscard]] static bool | [[nodiscard]] static bool |
241 | 241 | pool_run(ThreadPool::Data *p, unsigned int thread_count, | pool_run(ThreadPool::Data *p, unsigned int thread_count, |
File src/thread_pool_2.cpp changed (mode: 100644) (index 8fda4ec..72a7a1f) | |||
... | ... | struct thread_data { | |
55 | 55 | priority_shared waiters_min_priority; | priority_shared waiters_min_priority; |
56 | 56 | jth::condition waiters_condition; | jth::condition waiters_condition; |
57 | 57 | pool *p_pool; | pool *p_pool; |
58 | jth::thread<int> instance; | ||
58 | jth::thread<void*> instance; | ||
59 | 59 | }; | }; |
60 | 60 | static void | static void |
61 | 61 | thread_acquire_task(thread_data *p_thread, task *p_dst, priority *p_dst_p) { | thread_acquire_task(thread_data *p_thread, task *p_dst, priority *p_dst_p) { |
... | ... | FOUND: | |
113 | 113 | thread_acquire_task(p_thread, p_dst, p_dst_p); | thread_acquire_task(p_thread, p_dst, p_dst_p); |
114 | 114 | return true; | return true; |
115 | 115 | } | } |
116 | static int | ||
116 | static void* | ||
117 | 117 | thread(thread_data *p_thread) { | thread(thread_data *p_thread) { |
118 | 118 | p_thread->lock.lock(); | p_thread->lock.lock(); |
119 | 119 | for(;;) { | for(;;) { |
... | ... | thread(thread_data *p_thread) { | |
146 | 146 | p_thread->is_idle = false; | p_thread->is_idle = false; |
147 | 147 | } | } |
148 | 148 | p_thread->lock.unlock(); | p_thread->lock.unlock(); |
149 | return 0; | ||
149 | return nullptr; | ||
150 | 150 | } | } |
151 | 151 | [[nodiscard]] static bool | [[nodiscard]] static bool |
152 | 152 | thread_data_insert_task(thread_data *p_thread, task task, priority index) { | thread_data_insert_task(thread_data *p_thread, task task, priority index) { |