Skip to content

Commit

Permalink
Add private/nodoc to more methods
Browse files Browse the repository at this point in the history
  • Loading branch information
j8r committed Jul 2, 2020
1 parent 37b055b commit 76aaaf6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions spec/std/channel_spec.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "spec"
require "./spec_helper"
require "../../src/channel"

private def yield_to(fiber)
Crystal::Scheduler.enqueue(Fiber.current)
Expand Down
35 changes: 17 additions & 18 deletions src/channel.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ require "crystal/pointer_linked_list"
# they are discouraged since from certain methods or constructs it receiving a `nil` as data
# will be indistinguishable from a closed channel.
#
class Channel(T)
class AChannel(T)
@lock = Crystal::SpinLock.new
@queue : Deque(T)?

# :nodoc:
record NotReady
# :nodoc:
record UseDefault


private record NotReady

private record UseDefault

# :nodoc:
module SelectAction(S)
abstract def execute : DeliveryState
Expand Down Expand Up @@ -75,7 +74,7 @@ class Channel(T)
end
end

enum SelectState
private enum SelectState
None = 0
Active = 1
Done = 2
Expand Down Expand Up @@ -120,7 +119,7 @@ class Channel(T)
end
end

enum DeliveryState
private enum DeliveryState
None
Delivered
Closed
Expand Down Expand Up @@ -398,17 +397,19 @@ class Channel(T)
nil
end

# :nodoc:
def self.select(*ops : SelectAction)
self.select ops
end

# :nodoc:
def self.select(ops : Indexable(SelectAction))
i, m = select_impl(ops, false)
raise "BUG: blocking select returned not ready status" if m.is_a?(NotReady)
return i, m
end

@[Deprecated("Use Channel.non_blocking_select")]
# :nodoc:
def self.select(ops : Indexable(SelectAction), has_else)
# The overload of Channel.select(Indexable(SelectAction), Bool)
# is used by LiteralExpander with the second argument as `true`.
Expand All @@ -417,10 +418,12 @@ class Channel(T)
non_blocking_select(ops)
end

# :nodoc:
def self.non_blocking_select(*ops : SelectAction)
self.non_blocking_select ops
end

# :nodoc:
def self.non_blocking_select(ops : Indexable(SelectAction))
select_impl(ops, true)
end
Expand Down Expand Up @@ -495,8 +498,7 @@ class Channel(T)
LooseReceiveAction.new(self)
end

# :nodoc:
class StrictReceiveAction(T)
private class StrictReceiveAction(T)
include SelectAction(T)
property receiver : Receiver(T)

Expand Down Expand Up @@ -560,8 +562,7 @@ class Channel(T)
end
end

# :nodoc:
class LooseReceiveAction(T)
private class LooseReceiveAction(T)
include SelectAction(T)
property receiver : Receiver(T)

Expand Down Expand Up @@ -625,8 +626,7 @@ class Channel(T)
end
end

# :nodoc:
class SendAction(T)
private class SendAction(T)
include SelectAction(Nil)
property sender : Sender(T)

Expand Down Expand Up @@ -685,8 +685,7 @@ class Channel(T)
end
end

# :nodoc:
class TimeoutAction
private class TimeoutAction
include SelectAction(Nil)

# Total amount of time to wait
Expand Down

0 comments on commit 76aaaf6

Please sign in to comment.