Skip to content

Commit 922c747

Browse files
authored
Add function reinit_task (#58)
1 parent 54bdc4e commit 922c747

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/threadtasks.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ end
7676
yield()
7777
false
7878
end
79+
80+
# Like checktask, but without throwing errors.
81+
# This is used in Polyester.reset_threads!().
82+
@noinline function reinit_task(tid)
83+
t = TASKS[tid]
84+
if istaskfailed(t)
85+
initialize_task(tid)
86+
end
87+
yield()
88+
end
89+
7990
# 1-based tid
8091
@inline tasktid(p::Ptr{UInt}) = (p - THREADPOOLPTR[]) ÷ (THREADBUFFERSIZE)
8192
@inline wait(tid::Integer) = wait(taskpointer(tid), tid)

0 commit comments

Comments
 (0)