Is the main task always sticky?

$ julia -q
julia> current_task().sticky
true

It appears to currently be true, but is it always true that the main task is sticky, and will it stay true in future Julia versions?

Edit: I’m not asking because I view this as a limitation, I’m asking because I’d like to have a guarantee that it remains sticky. I need to know if I can run something on the main task and guarantee it won’t change thread.

2 Likes

I’m not aware of any real-world ramifications of this design. Seems that we can spawn tasks to other threads if they are heavy.

The REPL thread can be reserved for, e.g., printing progress info, querying states (taking keyboard input) etc.

Ah thanks but you misinferred the point of my question, have edited to clarify.

I don’t think this is actually guaranteed. I’d be curious to see how many things implicitly rely on this though :thinking:

I was considering explicitly relying on it :slightly_smiling_face: but only if it were guaranteed.