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

What you’re asking for is called task pinning, you can do it with the @spawnat macro from StableTasks.jl. I would recommend using a Channel for all the GUI updates and keep one pinned task reading from that Channel and processing the updates. The advantage of doing it with a single task instead of multiple tasks short-lived tasks is that you can easily implement something like logging to check the order in which updates are happening, which can be very useful when debugging.

2 Likes