Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typos #40

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/catalysts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/dualcontainers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 12 additions & 12 deletions examples/locks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}()))
Expand All @@ -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:
Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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[]

Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions examples/nack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
#=
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/promises.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/treiberstack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/Reagents.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__
Expand Down
2 changes: 1 addition & 1 deletion src/bags.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/computational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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})
Expand Down
4 changes: 2 additions & 2 deletions src/reactions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/tracing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions test/ReagentsTests/src/test_cancellablecontainers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/ReagentsTests/src/test_dualcontainers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
Loading