Pudu programming language
Menu

Std.Http.Server.stopOnSignal

1 declaration

fn

stopOnSignal: &Std.Http.Server.Running -> Bool

This is a callable function.

What it does

Stop the server when the supervisor asks the program to stop.

The drain below is careful and, until something calls `stop`, unreachable

in the one case it exists for: a deployment, where the request to stop

arrives as a signal. This is the wire between the two.

A thread does the waiting because accepting blocks: the loop is inside

`accept` when the signal arrives, and only closing the listener brings it

out. Closing is what `stop` already does, so the drain that follows is the

ordinary one and nothing here has to know how it works.

Answers whether the program can hear the request at all. `false` means this

platform has no such signal and the server will run until something else

stops it — worth reporting rather than assuming a drain that cannot happen.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.
  • & borrows a value for this call instead of moving or copying it.

Back to Std.Http.ServerSearch related declarations