Commit Graph

96 Commits

Author SHA1 Message Date
Manos 8c9e0ea8d7 Merge Lambda0x00 master 2023-12-18 15:39:03 +01:00
Manos 29e85feeea Merge ghost commits 2023-12-18 15:04:46 +01:00
Manos a4cdd6976a Merge branch 'master' of github.com:lambda0x00/C-Thread-Pool into lambda0x00-master 2023-12-18 15:01:28 +01:00
Kévin Dunglas d3f1967cd3
fix: ensure that SA_ONSTACK is declared 2023-12-18 13:51:48 +01:00
Kévin Dunglas 222340137b
Reapply "fix: set the SA_ONSTACK flag"
This reverts commit 81b76df72e.
2023-12-18 13:51:48 +01:00
Manos 81b76df72e
Revert "fix: set the SA_ONSTACK flag" 2023-12-18 10:48:01 +00:00
Manos 6c9410df87
Merge pull request #116 from dunglas/fix/SA_ONSTACK
fix: set the SA_ONSTACK flag
2023-12-18 11:42:46 +01:00
Manos 5ee62a1cd4
Merge pull request #122 from asvrada/patch-1
Fix typo in thpool.c
2023-12-18 11:38:15 +01:00
Manos 89f4d259fa
Merge pull request #126 from dunglas/fix/crash-on-mac
fix: properly destroy mutex during reset
2023-12-18 11:36:35 +01:00
Kévin Dunglas 96146f08b4
fix: properly destroy mutex during reset 2023-12-18 01:07:28 +01:00
Kévin Dunglas 734bdf4d95
feat: make the thread name configurable 2023-10-06 18:29:00 +02:00
Zijie Wu 59683c790d
Fix typo 2023-06-27 15:44:47 -07:00
Pierre Grimaud 3fe36a50af
docs: fix typos 2022-12-25 23:50:33 +01:00
Kévin Dunglas b2f44889cb
fix: set the SA_ONSTACK flag 2022-12-19 17:11:37 +01:00
Manos 0c6dfd0818
Merge pull request #105 from zlrs/fix/limit_thread_name_lenth_to_16
fix: limit thread name length to 16bytes
2022-11-30 12:31:19 +00:00
Kévin Dunglas 2ea22f1271
feat: compatiblity with Mac OS X 2022-09-30 22:42:10 +02:00
zlrs 3f46454ca9 fix: limit thread name length to 16bytes 2021-04-29 15:16:58 +08:00
Andrew Hicks 3cff334538
Fix error in FreeBSD 2021-03-16 20:58:16 -04:00
nil0x42 5fbe481965
Use safe snprintf() instead of sprintf()
The use of sprintf is considered unsafe. And besides being in this case not vulnerable, CI services such as deepcode.ai will send an annoying alert for projects using thpool, as in this example: 47376326b7/_/%2Fsrc%2Fthpool.c/cpp%2Fdc%2FBufferOverflowUnsafeFunction/321/code

The buffer is also bigger than needed: even if `thread_p->id` were to be an uint64_max, the generated string would still fit in 31 bytes (`thread-pool-9223372036854775807`); so buffer was set to 32 bytes instead of 128
2020-09-27 23:06:38 +00:00
Gonzalo Diethelm 0012ce22b9 Fix casting of function pointers
Found via -Wpedantic
2020-07-20 18:07:56 +02:00
Manos 0e1f9e8f17
Merge pull request #75 from gymbombom/master
thpool.c:458 ~ 464
2020-05-25 14:20:46 +01:00
RhythmLian 71f5bc9613
Fix warning at line 285.
It may can’t catch the malloc error.
2019-11-22 08:23:27 +08:00
andamiro f0d75f72eb thpool.c:458 ~ 464
modify Remark Message
2018-11-30 17:15:58 +09:00
Johan 0f9b66306b Merge pull request #49 from GandaG/gcc-warnings
Fix gcc warnings.
2017-01-29 18:14:42 +00:00
Daniel Nunes 29f1537116 Commented the warning supression in thpool_resume. 2017-01-29 18:10:45 +00:00
Pithikos a3916021c8 Add POSIX macro to remove any warnings under strict C compilation 2017-01-29 09:21:05 +00:00
Pithikos e108ee5ab6 Small refactoring without affecting functionality 2017-01-29 09:19:16 +00:00
Daniel Nunes 3ac7d25722 Fix unused arg gcc warnings. 2017-01-29 02:16:33 +00:00
Daniel Nunes 251b1125c6 Moved all error msgs to a central macro. 2017-01-24 15:09:45 +00:00
Daniel Nunes 8aa0c1c1a5 Added macro to disable print statements. 2017-01-22 15:10:45 +00:00
Daniel Nunes 7a2f4e76c7 Thread name warning should only appear under debug. 2017-01-22 03:39:15 +00:00
Pithikos 0b249383d7 Fix whitespace 2017-01-18 10:38:05 +00:00
Pithikos e906f2fa28 Solve warning about incompatible types 2017-01-18 10:37:04 +00:00
Pithikos 154e5832d9 Resolve conflicts 2017-01-18 10:07:23 +00:00
Pithikos 2ba0bd59fa Fix whitespace 2017-01-17 19:59:29 +00:00
Pithikos 48ae25d35a Add API function to get number of working threads 2017-01-17 19:58:44 +00:00
bowfin 52552779cc Change worker return type to void; add extern C
1. Worker return type void* is not handled, changing to void. 
2. Added extern "C" clause to help in C++ integration.
2016-09-04 00:17:18 -04:00
xiayula 23275063a4 fix one error msg 2016-07-29 15:36:18 +08:00
Medicine Yeh 49e5cbe5af Use prctl on Linux to follow standard GNU/Linux functions 2016-02-03 18:42:20 +08:00
Medicine Yeh ff84a85f43 forgot OS dependent macro 2016-02-03 18:29:14 +08:00
Medicine Yeh a721288235 add _GNU_SOURCE for pthread_setname_np, add NULL check for destroy
_GNU_SOURCE: http://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
NULL check: Some programs might get errors while initialization and thus fall to destroy process. This could prevent errors in this situations. Also this check could prevent some rare situations where thpool is free twice.
2016-02-03 18:18:20 +08:00
xiaokai1 e5e9aeee0c code style: remove space 2016-01-27 14:31:10 +08:00
Johan a56bffe8b7 Merge pull request #28 from marwankallal/return
Replaced `exit(1)`s with `return`s in thread pool initializer.
2016-01-22 10:38:40 +00:00
Johan 8d24894309 Merge pull request #25 from bpetri/master
Make threadpool more generic by replacing prctl => pthread_setname_np
2016-01-21 15:18:21 +00:00
Marwan Kallal a0c777488d replaced exit with return 2015-12-22 20:46:30 -05:00
Drew Weymouth da2c0fe45e move locking inside jobqueue_push and pull 2015-12-21 19:45:06 -08:00
Drew Weymouth 04cf949f9f refactoring jobqueue interface, jobqueue embedded in thpool struct 2015-12-21 19:36:36 -08:00
Marwan Kallal 5e5b177361 fixed #21 2015-12-18 13:17:32 -05:00
Bjoern Petri 9f4ac0616b Replace prctl w/ pthread_setname_np. Use predefined macros to differ btwn linux and os x. 2015-12-14 13:43:17 +01:00
Pithikos 594f1eee02 Error checking for valgrind is redundant since overlapping with other tests 2015-12-12 11:11:32 +00:00