summaryrefslogtreecommitdiff
path: root/lib/stdlib/test/shell_docs_SUITE_data/unknown_erlang_suspend_process_2_func.txt
blob: 7f22bae23c527b0d6bfd229c2b83605db473e514 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

  -spec erlang:suspend_process(Suspendee, OptList) -> boolean()
                                  when
                                      Suspendee :: pid(),
                                      OptList :: [Opt],
                                      Opt ::
                                          unless_suspending |
                                          asynchronous |
                                          {asynchronous, term()}.

  Increases the suspend count on the process identified by 
  Suspendee and puts it in the suspended state if it is not already
  in that state. A suspended process is not scheduled for execution
  until the process has been resumed.

  A process can be suspended by multiple processes and can be
  suspended multiple times by a single process. A suspended process
  does not leave the suspended state until its suspend count reaches
  zero. The suspend count of Suspendee is decreased when 
  erlang:resume_process(Suspendee) is called by the same process
  that called erlang:suspend_process(Suspendee). All increased
  suspend counts on other processes acquired by a process are
  automatically decreased when the process terminates.

  Options (Opts):

  asynchronous:
    A suspend request is sent to the process identified by 
    Suspendee. Suspendee eventually suspends unless it is
    resumed before it could suspend. The caller of 
    erlang:suspend_process/2 returns immediately, regardless of
    whether Suspendee has suspended yet or not. The point in
    time when Suspendee suspends cannot be deduced from other
    events in the system. It is only guaranteed that Suspendee 
    eventually suspends (unless it is resumed). If no 
    asynchronous options has been passed, the caller of 
    erlang:suspend_process/2 is blocked until Suspendee has
    suspended.

  {asynchronous, ReplyTag}:
    A suspend request is sent to the process identified by 
    Suspendee. When the suspend request has been processed, a
    reply message is sent to the caller of this function. The
    reply is on the form {ReplyTag, State} where State is
    either:

    exited:
      Suspendee has exited.

    suspended:
      Suspendee is now suspended.

    not_suspended:
      Suspendee is not suspended. This can only happen when the
      process that issued this request, have called 
      resume_process(Suspendee) before getting the reply.

    Appart from the reply message, the {asynchronous, ReplyTag}
    option behaves exactly the same as the asynchronous option
    without reply tag.

  unless_suspending:
    The process identified by Suspendee is suspended unless the
    calling process already is suspending Suspendee. If 
    unless_suspending is combined with option asynchronous, a
    suspend request is sent unless the calling process already is
    suspending Suspendee or if a suspend request already has
    been sent and is in transit. If the calling process already is
    suspending Suspendee, or if combined with option 
    asynchronous and a send request already is in transit, false
    is returned and the suspend count on Suspendee remains
    unchanged.

  If the suspend count on the process identified by Suspendee is
  increased, true is returned, otherwise false.

  Warning:
    This BIF is intended for debugging only.

  Warning:
    You can easily create deadlocks if processes suspends each
    other (directly or in circles). In ERTS versions prior to ERTS
    version 10.0, the runtime system prevented such deadlocks, but
    this prevention has now been removed due to performance
    reasons.

  Failures:

  badarg:
    If Suspendee is not a process identifier.

  badarg:
    If the process identified by Suspendee is the same process
    as the process calling erlang:suspend_process/2.

  badarg:
    If the process identified by Suspendee is not alive.

  badarg:
    If the process identified by Suspendee resides on another
    node.

  badarg:
    If OptList is not a proper list of valid Opts.

  system_limit:
    If the process identified by Suspendee has been suspended
    more times by the calling process than can be represented by
    the currently used internal data structures. The system limit
    is greater than 2,000,000,000 suspends and will never be
    lower.