mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Remove static initializers (#2059)
* Remove static initializers in device.cpp, load.cpp, pocketfft.h * Remove static initializer InTracing::trace_stack * Remove static initializer of CompilerCache cache * Revert changes in pocketfft.h * Remove duplicate private section of thread_pool()
This commit is contained in:
@@ -335,7 +335,10 @@ ThreadPool& thread_pool() {
|
||||
return pool_;
|
||||
}
|
||||
|
||||
ThreadPool ParallelFileReader::thread_pool_{4};
|
||||
ThreadPool& ParallelFileReader::thread_pool() {
|
||||
static ThreadPool thread_pool{4};
|
||||
return thread_pool;
|
||||
}
|
||||
|
||||
void ParallelFileReader::read(char* data, size_t n) {
|
||||
while (n != 0) {
|
||||
@@ -371,7 +374,8 @@ void ParallelFileReader::read(char* data, size_t n, size_t offset) {
|
||||
break;
|
||||
} else {
|
||||
size_t m = batch_size_;
|
||||
futs.emplace_back(thread_pool_.enqueue(readfn, offset, m, data));
|
||||
futs.emplace_back(
|
||||
ParallelFileReader::thread_pool().enqueue(readfn, offset, m, data));
|
||||
data += m;
|
||||
n -= m;
|
||||
offset += m;
|
||||
|
||||
Reference in New Issue
Block a user