@@ -434,10 +434,10 @@ defmodule GenServer do
434
434
except the process is hibernated before entering the loop. See
435
435
`c:handle_call/3` for more information on hibernation.
436
436
437
- Returning `{:ok, state, {:continue, continue }}` is similar to
437
+ Returning `{:ok, state, {:continue, continue_arg }}` is similar to
438
438
`{:ok, state}` except that immediately after entering the loop,
439
- the `c:handle_continue/2` callback will be invoked with the value
440
- `continue ` as first argument .
439
+ the `c:handle_continue/2` callback will be invoked with `continue_arg`
440
+ as the first argument and `state ` as the second one .
441
441
442
442
Returning `:ignore` will cause `start_link/3` to return `:ignore` and
443
443
the process will exit normally without entering the loop or calling
@@ -460,7 +460,7 @@ defmodule GenServer do
460
460
"""
461
461
@ callback init ( init_arg :: term ) ::
462
462
{ :ok , state }
463
- | { :ok , state , timeout | :hibernate | { :continue , term } }
463
+ | { :ok , state , timeout | :hibernate | { :continue , continue_arg :: term } }
464
464
| :ignore
465
465
| { :stop , reason :: any }
466
466
when state: any
@@ -487,9 +487,10 @@ defmodule GenServer do
487
487
`GenServer` causes garbage collection and leaves a continuous heap that
488
488
minimises the memory used by the process.
489
489
490
- Returning `{:reply, reply, new_state, {:continue, continue}}` is similar to
491
- `{:reply, reply, new_state}` except `c:handle_continue/2` will be invoked
492
- immediately after with the value `continue` as first argument.
490
+ Returning `{:reply, reply, new_state, {:continue, continue_arg}}` is similar to
491
+ `{:reply, reply, new_state}` except that `c:handle_continue/2` will be invoked
492
+ immediately after with `continue_arg` as the first argument and
493
+ `state` as the second one.
493
494
494
495
Hibernating should not be used aggressively as too much time could be spent
495
496
garbage collecting. Normally it should only be used when a message is not
@@ -512,7 +513,7 @@ defmodule GenServer do
512
513
process exits without replying as the caller will be blocking awaiting a
513
514
reply.
514
515
515
- Returning `{:noreply, new_state, timeout | :hibernate | {:continue, continue }}`
516
+ Returning `{:noreply, new_state, timeout | :hibernate | {:continue, continue_arg }}`
516
517
is similar to `{:noreply, new_state}` except a timeout, hibernation or continue
517
518
occurs as with a `:reply` tuple.
518
519
@@ -528,9 +529,10 @@ defmodule GenServer do
528
529
"""
529
530
@ callback handle_call ( request :: term , from , state :: term ) ::
530
531
{ :reply , reply , new_state }
531
- | { :reply , reply , new_state , timeout | :hibernate | { :continue , term } }
532
+ | { :reply , reply , new_state ,
533
+ timeout | :hibernate | { :continue , continue_arg :: term } }
532
534
| { :noreply , new_state }
533
- | { :noreply , new_state , timeout | :hibernate | { :continue , term } }
535
+ | { :noreply , new_state , timeout | :hibernate | { :continue , continue_arg :: term } }
534
536
| { :stop , reason , reply , new_state }
535
537
| { :stop , reason , new_state }
536
538
when reply: term , new_state: term , reason: term
@@ -551,9 +553,10 @@ defmodule GenServer do
551
553
`{:noreply, new_state}` except the process is hibernated before continuing the
552
554
loop. See `c:handle_call/3` for more information.
553
555
554
- Returning `{:noreply, new_state, {:continue, continue }}` is similar to
556
+ Returning `{:noreply, new_state, {:continue, continue_arg }}` is similar to
555
557
`{:noreply, new_state}` except `c:handle_continue/2` will be invoked
556
- immediately after with the value `continue` as first argument.
558
+ immediately after with `continue_arg` as the first argument and
559
+ `state` as the second one.
557
560
558
561
Returning `{:stop, reason, new_state}` stops the loop and `c:terminate/2` is
559
562
called with the reason `reason` and state `new_state`. The process exits with
@@ -564,7 +567,7 @@ defmodule GenServer do
564
567
"""
565
568
@ callback handle_cast ( request :: term , state :: term ) ::
566
569
{ :noreply , new_state }
567
- | { :noreply , new_state , timeout | :hibernate | { :continue , term } }
570
+ | { :noreply , new_state , timeout | :hibernate | { :continue , continue_arg :: term } }
568
571
| { :stop , reason :: term , new_state }
569
572
when new_state: term
570
573
@@ -581,12 +584,12 @@ defmodule GenServer do
581
584
"""
582
585
@ callback handle_info ( msg :: :timeout | term , state :: term ) ::
583
586
{ :noreply , new_state }
584
- | { :noreply , new_state , timeout | :hibernate | { :continue , term } }
587
+ | { :noreply , new_state , timeout | :hibernate | { :continue , continue_arg :: term } }
585
588
| { :stop , reason :: term , new_state }
586
589
when new_state: term
587
590
588
591
@ doc """
589
- Invoked to handle ` continue` instructions.
592
+ Invoked to handle continue instructions.
590
593
591
594
It is useful for performing work after initialization or for splitting the work
592
595
in a callback in multiple steps, updating the process state along the way.
@@ -596,11 +599,11 @@ defmodule GenServer do
596
599
This callback is optional. If one is not implemented, the server will fail
597
600
if a continue instruction is used.
598
601
"""
599
- @ callback handle_continue ( continue :: term , state :: term ) ::
602
+ @ callback handle_continue ( continue_arg , state :: term ) ::
600
603
{ :noreply , new_state }
601
- | { :noreply , new_state , timeout | :hibernate | { :continue , term } }
604
+ | { :noreply , new_state , timeout | :hibernate | { :continue , continue_arg } }
602
605
| { :stop , reason :: term , new_state }
603
- when new_state: term
606
+ when new_state: term , continue_arg: term
604
607
605
608
@ doc """
606
609
Invoked when the server is about to exit. It should do any cleanup required.
0 commit comments