Skip to content

Commit

Permalink
safe way to put!(channel) from R
Browse files Browse the repository at this point in the history
  • Loading branch information
schlichtanders committed Nov 15, 2023
1 parent e6518f1 commit 3749c03
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JolinPluto"
uuid = "5b0b4ef8-f4e6-4363-b674-3f031f7b9530"
authors = ["Stephan Sahm <[email protected]> and contributors"]
version = "0.1.49"
version = "0.1.50"

[deps]
AWS = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
Expand Down
2 changes: 1 addition & 1 deletion src/JolinPluto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module JolinPluto
export @get_jwt, @authorize_aws
export get_jwt, authorize_aws
export @repeat_take!, @repeat_at, @repeat_run, @Channel
export repeat_take!, repeat_take, repeat_at, repeat_run, ChannelPluto, repeat_queueget
export repeat_take!, repeat_take, repeat_at, repeat_run, ChannelPluto, repeat_queueget, repeat_put_at, NoPut
export @output_below, @clipboard_image_to_clipboard_html
export output_below, clipboard_image_to_clipboard_html, embedLargeHTML
export Setter, @get, @cell_ids_create_wrapper, @cell_ids_push!
Expand Down
12 changes: 12 additions & 0 deletions src/tasks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,18 @@ function repeat_at(
repeat_run(init, wait_and_repeatme)
end

struct NoPutType end
const NoPut = NoPutType()

function repeat_put_at(channel, getvalue, nexttime)
repeat_at(nexttime) do time
value = getvalue(time)
value === NoPut && return
put!(channel, value)
value
end
end


"""
nextvalue = @repeat_take! channel
Expand Down

0 comments on commit 3749c03

Please sign in to comment.