summaryrefslogtreecommitdiff
path: root/src/support/threads.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Use ifdef-else in threads.cpp (#6355)Alon Zakai2024-02-271-2/+2
|
* [Emscripten port] Fix core count logic for Emscripten+pthreads (#6350)Alon Zakai2024-02-261-3/+5
| | | | Before this all Emscripten builds would use 1 core, but it is important to allow pthreads builds there to use more.
* [NFC] Remove our bespoke `make_unique` implementation (#5613)Thomas Lively2023-03-311-3/+3
| | | | This code predates our adoption of C++14 and can now be removed in favor of `std::make_unique`, which should be more efficient.
* Use C++17's [[maybe_unused]]. NFC (#5309)Sam Clegg2022-12-021-2/+1
|
* clang-tidy braces changes (#2075)Alon Zakai2019-05-011-1/+2
| | | Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-17/+26
| | | Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
* Don't call static desructors when Fatal() errors occur (#1722)Sam Clegg2018-11-021-2/+2
| | | | | This was causing a deadlock while destroying the thread pool.
* Simplify ThreadPool::isRunning (#1391)Alon Zakai2018-01-301-2/+1
| | | | | | * simplify ThreadPool::isRunning: it doesn't need to be static and to go through the global unique_ptr * it's undefined behavior to access the threadpool from a shutting down thread, as the parent is being destroyed
* ThreadPool refactoring (#1389)Alon Zakai2018-01-261-31/+31
| | | | | | | | Refactor ThreadPool code for clarity and to fix some bugs with using the pool from different threads in parallel. We have a singleton pool, and need to ensure it is created only once and used only by one thread at a time. This model is a simple way to ensure we use a number of threads equal to the number of cores, more or less (a pool per Module might lead to number of cores * number of Modules being optimized). This refactoring adds a parent pointer in the worker threads (giving them direct access to the pool makes it simpler to make sure that pool and thread creation and teardown are threadsafe). This commit also adds proper locking around pool creation and pool usage.
* Threading fixes (#1377)Alon Zakai2018-01-241-4/+20
| | | | | | * threading fixes, be careful when creating the pool (more than one thread may try to) and don't create it just to check if its running in the thread constructor assertions * child threads will call ::get() - don't do initialize() under the lock
* Thread fixes (#1205)Alon Zakai2017-10-021-1/+8
| | | | | | * don't use multiple threads in torture tests, which are parallel anyhow * if we fail to create a thread, don't use multiple threads
* New binaryen.js (#922)Alon Zakai2017-03-241-0/+4
| | | New binaryen.js implementation, based on the C API underneath and with a JS-friendly API on top. See docs under docs/ for API details.
* Replace std::unique<T>(new T()) with make_unique<T>().Logan Chien2016-08-261-3/+4
| | | | | | | | | | | | | | | | This commit modernize the code base by replacing: std::unique_ptr<T>(new T(...)) with: make_unique<T>(...) or: wasm::make_unique<T>(...) This is a step closer to adopt C++14 std::make_unique<T>(...).
* use WASM_UNUSED in some places to fix compiler warning/error on unused ↵Alon Zakai2016-06-081-0/+2
| | | | variables we only use in asserts (#579)
* refactor a getNumCores methodAlon Zakai2016-06-021-5/+9
|
* Add missing algorithm and string headersJF Bastien2016-04-231-0/+2
| | | As in #382.
* fix ThreadPool::size, we don't have any thread objects created if there is ↵Alon Zakai2016-04-181-1/+1
| | | | just one core, since then we run it all on the main thread anyhow
* allow limiting # of cores in thread pool, useful for debuggingAlon Zakai2016-04-181-0/+3
|
* Function parallelism (#343)Alon Zakai2016-04-151-0/+181
* allow traversals to mark themselves as function-parallel, in which case we run them using a thread pool. also mark some thread-safety risks (interned strings, arena allocators) with assertions they modify only on the main thread