Skip to content

Commit b127c45

Browse files
committed
fix problem caused by interactive threads being janky
1 parent 933a4f2 commit b127c45

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StableTasks"
22
uuid = "91464d47-22a1-43fe-8b7f-2d57ee82463f"
33
authors = ["Mason Protter <[email protected]>"]
4-
version = "0.1.1"
4+
version = "0.1.2"
55

66
[compat]
77
julia = "1.6"

src/internals.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ macro spawn(ex)
3232
var = esc(Base.sync_varname) # This is for the @sync macro which sets a local variable whose name is
3333
# the symbol bound to Base.sync_varname
3434
# I asked on slack and this is apparently safe to consider a public API
35+
set_pool = if VERSION < v"1.9"
36+
nothing
37+
else
38+
:(Threads._spawn_set_thrpool(task, :default))
39+
end
3540
quote
3641
let $(letargs...)
3742
f = $thunk
@@ -40,6 +45,7 @@ macro spawn(ex)
4045
f_wrap = () -> (ref[] = f(); nothing)
4146
task = Task(f_wrap)
4247
task.sticky = false
48+
$set_pool
4349
if $(Expr(:islocal, var))
4450
put!($var, task) # Sync will set up a Channel, and we want our task to be in there.
4551
end

0 commit comments

Comments
 (0)