Skip to content

Commit ee39369

Browse files
authored
Merge branch 'master' into atomic
2 parents e8ec8cb + 283b178 commit ee39369

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/internals.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ end
2727
Base.schedule(t::StableTask) = (schedule(t.t); t)
2828
Base.schedule(t, val; error=false) = (schedule(t.t, val; error); t)
2929

30-
30+
"""
31+
Similar to `Threads.@spawn` but type-stable. Creates a `Task` and schedules it to run on any available thread in the `:default` threadpool.
32+
"""
3133
macro spawn(args...)
3234
tp = QuoteNode(:default)
3335
na = length(args)
@@ -47,6 +49,7 @@ macro spawn(args...)
4749
else
4850
throw(ArgumentError("wrong number of arguments in @spawn"))
4951
end
52+
5053
letargs = _lift_one_interp!(ex)
5154

5255
thunk = replace_linenums!(:(() -> ($(esc(ex)))), __source__)
@@ -71,6 +74,10 @@ macro spawn(args...)
7174
end
7275
end
7376

77+
"""
78+
Similar to `StableTasks.@spawn` but creates a **sticky** `Task` and schedules it to run on the thread with the given id (`thrdid`).
79+
The task is guaranteed to stay on this thread (it won't migrate to another thread).
80+
"""
7481
macro spawnat(thrdid, ex)
7582
letargs = _lift_one_interp!(ex)
7683

0 commit comments

Comments
 (0)