aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/concurrency/actor.lux
blob: 4a25c2f77065e500495fdac958e574653a70e3c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
(.using
 [library
  [lux (.except if loop)
   ["$" documentation (.only documentation:)]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]]
   [macro
    ["[0]" template]]]]
 [\\library
  ["[0]" /]])

(documentation: (/.Actor state)
  "An entity that can react to messages (mail) sent to it concurrently.")

(documentation: (/.Mail state)
  "A one-way message sent to an actor, without expecting a reply.")

(documentation: (/.Obituary state)
  "Details on the death of an actor.")

(documentation: (/.Behavior state)
  "An actor's behavior when mail is received.")

(documentation: /.spawn!
  "Given a behavior and initial state, spawns an actor and returns it.")

(documentation: /.obituary
  "Await for an actor to stop working.")

(documentation: /.mail!
  "Send mail to an actor.")

(documentation: (/.Message state output)
  "A two-way message sent to an actor, expecting a reply.")

(documentation: /.tell!
  "Communicate with an actor through message-passing.")

(documentation: /.default
  "Default actor behavior.")

(documentation: /.poison!
  (format "Kills the actor by sending mail that will kill it upon processing,"
          \n "but allows the actor to handle previous mail."))

(documentation: /.Stop
  "A signal to stop an actor from observing a channel.")

(documentation: /.observe!
  (format "Use an actor to observe a channel by transforming each datum"
          \n "flowing through the channel into mail the actor can process."
          \n "Can stop observing the channel by executing the Stop value."))

(.def .public documentation
  (.List $.Module)
  ($.module /._
            "The actor model of concurrency."
            [..Actor
             ..Mail
             ..Obituary
             ..Behavior
             ..spawn!
             ..obituary
             ..mail!
             ..Message
             ..tell!
             ..default
             ..poison!
             ..Stop
             ..observe!
             ($.default /.poisoned)
             ($.default /.dead)
             ($.default /.alive?)
             ($.default /.obituary')]
            []))