# Is it possible to force a task to have a particular thread id?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-force-a-task-to-have-a-particular-thread-id/129172>\
**Category:** General Usage\
**Tags:** multithreading, concurrency, gui, qml\
**Created:** [May 20, 2025, 10:50am UTC](https://discourse.julialang.org/t/is-it-possible-to-force-a-task-to-have-a-particular-thread-id/129172 "2025-05-20T10:50:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 20, 2025, 12:18pm UTC](https://discourse.julialang.org/t/is-it-possible-to-force-a-task-to-have-a-particular-thread-id/129172/2 "2025-05-20T12:18:00Z")

</div>

Have you read this recent discussion and the links therein?

> [@Why has simple threading using \`threadid\` become so complex in v1.12...?](https://discourse.julialang.org/t/why-has-simple-threading-using-threadid-become-so-complex-in-v1-12/129135/6):
>
> The documentation for both OhMyThreads.jl and ChunkSplitters.jl do a great job at explaining how “simple” multithreading can work. As an example, [using ChunkSplitters.jl](https://juliafolds2.github.io/ChunkSplitters.jl/stable/multithreading/#@threads-and-enumerate), you could do: # setup n = Threads.nthreads() ds = mutable\_datastructure() dss = [deepcopy(ds) for \_ in 1:n] outputs = zeros(length(some\_iterable)) Threads.@threads for (i, c) in enumerate(chunks(some\_iterable; n=n)) local ds = dss[i] for j in c outputs[j] = computation!(ds, j) end end

I’ve not looked into this deeply, but the general gist I get from these conversations is that you shouldn’t rely on the thread id for anything.

---

_[View the full topic](https://discourse.julialang.org/t/is-it-possible-to-force-a-task-to-have-a-particular-thread-id/129172)._
