Skip to content

Commit ece7f24

Browse files
committed
doc update
1 parent 7dbc8d8 commit ece7f24

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lib/concurrent/actor/reference.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(core)
1616
@core = Type! core, Core
1717
end
1818

19-
# tells message to the actor
19+
# tells message to the actor, returns immediately
2020
# @param [Object] message
2121
# @return [Reference] self
2222
def tell(message)
@@ -25,16 +25,25 @@ def tell(message)
2525

2626
alias_method :<<, :tell
2727

28-
# tells message to the actor
28+
# @note it's a good practice to use tell whenever possible. Ask should be used only for
29+
# testing and when it returns very shortly. It can lead to deadlock if all threads in
30+
# global_task_pool will block on while asking. It's fine to use it form outside of actors and
31+
# global_task_pool.
32+
#
33+
# sends message to the actor and asks for the result of its processing, returns immediately
2934
# @param [Object] message
3035
# @param [Ivar] ivar to be fulfilled be message's processing result
3136
# @return [IVar] supplied ivar
3237
def ask(message, ivar = IVar.new)
3338
message message, ivar
3439
end
3540

36-
# @note can lead to deadlocks, use only in tests or when you are sure it won't deadlock
37-
# tells message to the actor
41+
# @note it's a good practice to use tell whenever possible. Ask should be used only for
42+
# testing and when it returns very shortly. It can lead to deadlock if all threads in
43+
# global_task_pool will block on while asking. It's fine to use it form outside of actors and
44+
# global_task_pool.
45+
#
46+
# sends message to the actor and asks for the result of its processing, blocks
3847
# @param [Object] message
3948
# @param [Ivar] ivar to be fulfilled be message's processing result
4049
# @return [Object] message's processing result

0 commit comments

Comments
 (0)