Skip to content

Commit

Permalink
improved timer
Browse files Browse the repository at this point in the history
  • Loading branch information
louisponet committed Jan 21, 2023
1 parent 1b4ee6b commit 4799a5f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ macro timeout(seconds, expr, err_expr=:(nothing))
esc(quote
tsk__ = @task $expr
schedule(tsk__)
start_time = time()
curt = time()
start_time__ = time()
curt__ = time()
Base.Timer(0.001, interval=0.001) do timer__
if tsk__ === nothing || istaskdone(tsk__)
close(timer__)
else
curt = time()
if curt - start_time > $seconds
curt__ = time()
if curt__ - start_time__ > $seconds
Base.throwto(tsk__, InterruptException())
end
end
Expand Down

2 comments on commit 4799a5f

@louisponet
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/76130

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.10 -m "<description of version>" 4799a5f7d5ca4015aa0a9b03c34985aa70561396
git push origin v0.3.10

Please sign in to comment.