Commit Graph

14 Commits

Author SHA1 Message Date
Lukas Matena
c12eff19d8 Fixed a possible deadlock:
The thread counter should be modified under a mutex, atomic is not enough here
2021-10-18 16:24:15 +02:00
Vojtech Bubnik
f9a5ee725d Follow-up to ae7d6db1d9
Exporting G-code on a worker thread did not work correctly as the worker
threads were using user's locale, not "C" locale.
The "C" locale is newly enforced to TBB worker threads by
name_tbb_thread_pool_threads_set_locale()
2021-09-13 13:04:12 +02:00
Vojtech Bubnik
3a5a0575ef Fixed after removing TBB deprecated APIs 2021-06-23 15:24:05 +02:00
Roman Beránek
e13535f822
drop deprecated TBB components (#6590)
Quite some time ago, many of the TBB components were deprecated in favor
of their near-equivalents in the STL or, in the case of task_scheduler_init,
were broken up and reconstituted under a less ad-hoc logic. Every time a header
file marked deprecated gets included, a rather loud warning is emitted, which
leads to a complete TBB's domination over the stderr stream during build time,
making it harder to notice _legitimate_ warnings.

Instead of merely muting the output with TBB_SUPPRESS_DEPRECATED_MESSAGES,
perform a genuine migration away from the deprecated components with the added
benefit of achieving a source compatibility with oneTBB, the successor to TBB
which has dropped the deprecated API for good.

What got replaced for what?

| Deprecated				| Replacement					|
| ------------------------------------- | --------------------------------------------- |
| `tbb::atomic`				| `std::atomic`					|
| `tbb::mutex`				| `std::mutex`					|
| `tbb::mutex::scoped_lock`		| `std::scoped_lock<std::mutex>`		|
| `tbb::mutex::scoped_lock` (empty)	| `std::unique_lock<std::mutex>` (deferred)	|
| `tbb::task_scheduler_init`		| `tbb::global_control`				|
| `tbb::this_thread`			| `std::this_thread`				|

Signed-off-by: Roman Beranek <roman.beranek@prusa3d.com>
2021-06-23 11:48:48 +02:00
Vojtech Bubnik
b002c1485d Fix of PrusaSlicer hangs on Linux when run with non standard task affinity #5661 2021-01-04 09:03:49 +01:00
Yuri D'Elia
44f71f0ed1 Include <atomic> for std::atomic where needed
Fixes build on linux using clang 11
2020-12-13 19:41:47 +01:00
Vojtech Bubnik
ce020781d3 Refactored loading of Get/SetThreadDescription() on Windows:
These new API functions are not available on Windows 7 and on older Windows 10,
thus they are newly loaded dynamically and the functions using it retur
a bool indicating whether the functionality is supported or not.
Also the OSX variants that are not supported newly return false instead
of throwing an exception.

Fixes #4972 #4974
2020-10-26 08:09:17 +01:00
Lukas Matena
5670f5ffb0 Fix couple of build issues on gcc 2020-10-23 07:51:58 +02:00
Vojtech Bubnik
d8f45ff1d8 Workarounds and documentation of OSX posix incompatibilities 2020-10-22 14:57:50 +02:00
Vojtech Bubnik
723406dfea Workaround for OSX non-compliant implementation of
pthread_getname_np / pthread_setname_np
2020-10-22 14:45:15 +02:00
Vojtech Bubnik
0d2c31d0e4 and again a fix on Windows 2020-10-22 14:35:20 +02:00
Vojtech Bubnik
6e2a5419cc Fixes of previous commit on Posix platforms 2020-10-22 14:29:40 +02:00
Vojtech Bubnik
81b6883710 Thread names shortened to 15 characters to fit Posix norm.
Added get_current_thread_name()
2020-10-22 14:11:08 +02:00
Vojtech Bubnik
6531061d09 Support for naming slicer own threads for debugging.
The following threads are named with this commit:
slic3r_main, slic3r_BackgroundSlicingProcess,
slic3r_tbbpool_xx_yy where xx is a one based index of the TTB thread
and yy is the platform thread ID.
2020-10-22 13:54:15 +02:00