diff --git a/examples/catalysts.jl b/examples/catalysts.jl index 051ed10..eca1632 100644 --- a/examples/catalysts.jl +++ b/examples/catalysts.jl @@ -61,7 +61,7 @@ function test_zip2() sendall, receiveall = Reagents.channel(Tuple{Int,Char}, Nothing) #= - If the items are aviable in `receive1` and `receive2`, the `catalyst` + If the items are available in `receive1` and `receive2`, the `catalyst` reagent automatically tries to pass them to `sendall`: =# catalyst = (receive1 & receive2) ⨟ sendall diff --git a/examples/dualcontainers.jl b/examples/dualcontainers.jl index 0554c53..863d524 100644 --- a/examples/dualcontainers.jl +++ b/examples/dualcontainers.jl @@ -22,7 +22,7 @@ function dualcontainer(::Type{T}, Items, Reservations = Items) where {T} ) end -# APIs required for the containres: +# APIs required for the containers: function putting end function taking end diff --git a/examples/locks.jl b/examples/locks.jl index a350087..6e2c870 100644 --- a/examples/locks.jl +++ b/examples/locks.jl @@ -21,10 +21,10 @@ end # acquire the lock will block until the element is put back into the container: acquiring(l::SimpleLock) = taking(l.access) -realeasing(l::SimpleLock) = Return(nothing) ⨟ putting(l.access) +releasing(l::SimpleLock) = Return(nothing) ⨟ putting(l.access) Base.lock(l::SimpleLock) = acquiring(l)() -Base.unlock(l::SimpleLock) = realeasing(l)() +Base.unlock(l::SimpleLock) = releasing(l)() # Thus, when creating a lock with an empty container, it is in the locked state. # We need to unlock it (i.e., put one element in the container) before start @@ -187,8 +187,8 @@ end # ## Semaphore # -# `SimpleLock` can be extended to a semaphore by just initially fillying more -# than one elements: +# `SimpleLock` can be extended to a semaphore by just initially filling more +# than one element: struct SimpleSemaphore accesses::typeof(Blocking(TreiberStack{Nothing}())) @@ -204,10 +204,10 @@ function SimpleSemaphore(n::Integer) end acquiring(l::SimpleSemaphore) = taking(l.accesses) -realeasing(l::SimpleSemaphore) = Return(nothing) ⨟ putting(l.accesses) +releasing(l::SimpleSemaphore) = Return(nothing) ⨟ putting(l.accesses) Base.acquire(l::SimpleSemaphore) = acquiring(l)() -Base.release(l::SimpleSemaphore) = realeasing(l)() +Base.release(l::SimpleSemaphore) = releasing(l)() # Unlike `SimpleLock`, we can acquire `SimpleSemaphore(n)` `n` times before # blocked: @@ -238,13 +238,13 @@ struct ChLock <: Base.AbstractLock end acquiring(l::ChLock) = l.acq -realeasing(l::ChLock) = l.rel +releasing(l::ChLock) = l.rel Base.lock(l::ChLock) = acquiring(l)() -Base.unlock(l::ChLock) = realeasing(l)() +Base.unlock(l::ChLock) = releasing(l)() # To create two kinds of locks, we create `2 * 2 = 4` channels. The state of -# the lock is mantained by two blocking data structures (Note: We only need to +# the lock is maintained by two blocking data structures (Note: We only need to # store at most one element. So, a stack is an overkill. But that's the most # cheap data structure we have implemented so far in the tutorial): @@ -323,7 +323,7 @@ function test_reader_writer_lock() sleep(0.1) @test !wlocked[] end - @test r2() === r2() === :done # releaseing `rlock` + @test r2() === r2() === :done # releasing `rlock` @test r1() == 3 @test wlocked[] @@ -350,10 +350,10 @@ function test_reader_writer_lock() sleep(0.1) @test r4locked[] == r5locked[] == false end - @test r2() === :done # releaseing `wlock` + @test r2() === :done # releasing `wlock` @test sort!([r1(), r1()]) == [4, 5] @test r4locked[] == r5locked[] == true - @test r2() === r2() === :done # releaseing `rlock` + @test r2() === r2() === :done # releasing `rlock` end end diff --git a/examples/nack.jl b/examples/nack.jl index ca3c99c..16ba58b 100644 --- a/examples/nack.jl +++ b/examples/nack.jl @@ -32,7 +32,7 @@ function nack_demo() s1, r1 = Reagents.channel() s2, r2 = Reagents.channel() #= - To receive the negative acknowledgement, we craete one more channel: + To receive the negative acknowledgement, we create one more channel: =# send_gotnack, receive_gotnack = Reagents.channel() #= @@ -55,7 +55,7 @@ function nack_demo() choice = br1 | br2 #= Returning the reagents so that they can be invoked differently for trying - differnt scenarios: + different scenarios: =# return (; choice, s1, s2, receive_gotnack) end @@ -131,7 +131,7 @@ function unique_id_provider!(request_receive, shutdown_receive) receive_request_or_shutdown = request_receive | shutdown_receive #= When the `shutdown_receive` reagent is chosen (i.e., the reaction result - is `nothing`), the short-circuting `@something` evaluates the `break` + is `nothing`), the short-circuiting `@something` evaluates the `break` statement so that the server exits the loop: =# (; reply, abort) = @something(receive_request_or_shutdown(), break) @@ -235,7 +235,7 @@ function test_unique_id_provider() @test unique_id() == prev + 1 break #= - If `receive` was not tirggered, we keep the id `ans` so that it + If `receive` was not triggered, we keep the id `ans` so that it can be used in the next iteration: =# else diff --git a/examples/promises.jl b/examples/promises.jl index fd1eb4f..f4559c7 100644 --- a/examples/promises.jl +++ b/examples/promises.jl @@ -22,7 +22,7 @@ function test_promise_fetches() p = Promise{Int}() #= - Calling `fetch(p::Promise)` will wait for `p` to be fullfiled: + Calling `fetch(p::Promise)` will wait for `p` to be fulfilled: =# task = @task fetch(p) yield(task) @@ -62,7 +62,7 @@ function test_promise_close_before_fetches() close(p) #= - Then, previously blocked `fetch(::Promise)` rasies an exception: + Then, previously blocked `fetch(::Promise)` raises an exception: =# err = try wait(t) diff --git a/examples/treiberstack.jl b/examples/treiberstack.jl index 18889d4..208c2c5 100644 --- a/examples/treiberstack.jl +++ b/examples/treiberstack.jl @@ -90,7 +90,7 @@ function test_trypopping() =# @test trypopping(stack)(nothing) === Some(222) #= - For convinience, `nothing` is the default argument when the reagent is + For convenience, `nothing` is the default argument when the reagent is called without an argument: =# @test trypopping(stack)() === Some(111) diff --git a/src/Reagents.jl b/src/Reagents.jl index 692ff2c..8221c53 100644 --- a/src/Reagents.jl +++ b/src/Reagents.jl @@ -17,7 +17,7 @@ struct Retry <: Failure end # The original implementation by Turon (2012) combines what is called `Reactor` # and `Reagent` here simply as reagent. This is structurally identical to how # Transducers.jl splits transducers (`Reagent` here) and reducing functions -# (`Reactor` here). It makes implemneting the pairting combinator `&` (`Both`) +# (`Reactor` here). It makes implementing the pairing combinator `&` (`Both`) # easier (which is similar to `Transducers.TeeZip`). struct Reactor{R<:Reagent,C} reagent::R @@ -154,8 +154,8 @@ A module that re-exports a subset of Reagents public API at top-level. Use `using Reagents.*` to import all public APIs. Do not use this inside a package. The set of exported names is not the part of stable API. For example, -if a name collistion with `Base` or important packages are recognized, the -corresponding name may be removed in the next realease, without incrementing +if a name collision with `Base` or important packages are recognized, the +corresponding name may be removed in the next release, without incrementing the leading non-zero version number. """ const * = __Reagents_API__ diff --git a/src/bags.jl b/src/bags.jl index 5e46674..b749ccb 100644 --- a/src/bags.jl +++ b/src/bags.jl @@ -32,7 +32,7 @@ function Base.iterate(bag::Bag, (prev, curr) = (bag, @atomic bag.next)) msgs = bag, ) end - # `prev` may be phisically removed while `curr` is phisically removed. + # `prev` may be physically removed while `curr` is physically removed. # But this is OK since `curr` is already logically removed. # TODO: check this curr, ok = @atomicreplace(prev.next, curr => next) diff --git a/src/computational.jl b/src/computational.jl index bcc7946..9cb6b9f 100644 --- a/src/computational.jl +++ b/src/computational.jl @@ -58,7 +58,7 @@ function tryreact!( return tryreact!(Commit(), value, rx, offer) elseif ans isa Retry # Assuming the continuation has `Swap`, it must eventually return - # `Block`. So, retring the reaction should be fine. + # `Block`. So, retrying the reaction should be fine. return ans else return ans @@ -69,7 +69,7 @@ hascas(::Map) = false maysync(::Map) = false # `Map`, `Return`, etc. may return `Block` for nudging reactions to try other # branches (and also to indicate that `offer` is required). But these reagents -# themselves do not attempt to sync. It *seems* like retruning `false` in this +# themselves do not attempt to sync. It *seems* like returning `false` in this # case is more useful; see how `ReturnIfBlocked` use it for deadlock detection. function tryreact!(actr::Reactor{<:Map}, a, rx::Reaction, offer::Union{Offer,Nothing}) diff --git a/src/reactions.jl b/src/reactions.jl index 5e66951..9fd3018 100644 --- a/src/reactions.jl +++ b/src/reactions.jl @@ -72,14 +72,14 @@ offerid(::Nothing) = UInt(0) * `offers::ImmutableList{Offer}` * `postcommithooks::ImmutableList{Any}` -* `restart_on_failure::Bool` (default: `false`): A flag controlling if the +* `restart_on_failure::Bool` (default: `false`): A flag controling if the offer should be invalidated on the failure. Consider `(r | s) ⨟ t` where `s` and `t` both contain a `Swap`. When a `Swap` in `s` is triggered from the dual, it may indicate that `r` is now reactable (i.e., `s` is used as a condition variable). In this case, it is now required to register the offer at `t`. To support this behavior, `restart_on_failure` is set to `true` in the continuations of `Choice` (`|`). Then, in `tryreact!`, the offers of the - dual messsage in `Swap` with `restart_on_failure` flag set are aborted. In + dual message in `Swap` with `restart_on_failure` flag set are aborted. In particular, if the state is in `Waiting`, the task is re-scheduled so that other branches of `|` can be re-evaluated. """ diff --git a/src/tracing.jl b/src/tracing.jl index cdffa6f..6e7daeb 100644 --- a/src/tracing.jl +++ b/src/tracing.jl @@ -19,7 +19,7 @@ macro trace(args...) nothing end |> esc end -# TODO: Use Preferences.jl to controll if Recalls.jl should be loaded? Since +# TODO: Use Preferences.jl to control if Recalls.jl should be loaded? Since # `args` may affect what variables are captured in closures, the existence of # Recalls.jl changes the program slightly. diff --git a/test/ReagentsTests/src/test_cancellablecontainers.jl b/test/ReagentsTests/src/test_cancellablecontainers.jl index 6d8bc33..4037d3d 100644 --- a/test/ReagentsTests/src/test_cancellablecontainers.jl +++ b/test/ReagentsTests/src/test_cancellablecontainers.jl @@ -105,7 +105,7 @@ function check_repeat_cancellation(constructor, spawn::Bool; nitems = 100, rando push!(dest, y) randomize && random_sleep() end - @debug "`check_repeat_cancellation`: Reciever $i done" + @debug "`check_repeat_cancellation`: Receiver $i done" end end @@ -160,7 +160,7 @@ function check_repeat_cancellation(constructor, spawn::Bool; nitems = 100, rando push!(allreceived, something(y)) nleft += 1 end - @debug "`check_repeat_cancellation`: $nleft items not recieved; $ncleaned refs cleaned" + @debug "`check_repeat_cancellation`: $nleft items not received; $ncleaned refs cleaned" # Not using `@test` to avoid overhead in while "fuzzing" @check length(allreceived) == length(allsent) diff --git a/test/ReagentsTests/src/test_dualcontainers.jl b/test/ReagentsTests/src/test_dualcontainers.jl index 36b38c7..cdf34bc 100644 --- a/test/ReagentsTests/src/test_dualcontainers.jl +++ b/test/ReagentsTests/src/test_dualcontainers.jl @@ -104,7 +104,7 @@ function test_many_items(constructor, spawn::Bool, nrepeat = 1000) y == sentinel && break push!(dest, y) end - @debug "`test_many_items`: Reciever $i done" + @debug "`test_many_items`: Receiver $i done" end end @@ -147,7 +147,7 @@ function test_many_items(constructor, spawn::Bool, nrepeat = 1000) push!(allreceived, something(y)) nleft += 1 end - @debug "`test_many_items`: $nleft items not recieved; $ncleaned refs cleaned" + @debug "`test_many_items`: $nleft items not received; $ncleaned refs cleaned" @test length(allreceived) == length(allsent) @test sort!(allreceived) == allsent