Closed WhateverLiu closed 4 months ago
If you're only using one scheduler (the default), then you can use parlay::worker_id()
. If you're using multiple schedulers, worker id's will be non-unique (each scheduler will have their own workers numbered 0 through num_workers
), and instead there is parlay::internal::get_thread_id()
, which will give a unique integer up to the number of threads total across all schedulers.
Feel free to try these, however, do note that they are still experimental features and subject to change in the future, which is why we don't currently advertise them in the documentation.
I enjoy parlay so much that I want to integrate it with my own linear memory allocator. For that to work, I need a function like
tbb::this_task_arena::current_thread_index()
that returns the thread index $\in[0, \text{maxConcurrency})$. I browsed parlay's source code but didn't find an equivalent. For now I just compile parlay with tbb but would like to know if the native thread pool can help achieve the goal.:)