Capy-Bearer Documentation

port_close

lib call

Capy

function port_close(handle : u64)

Description

port_close() closes a port. A spawned child receives SIGTERM; its SERVICE:EXIT still arrives when it has ended. A connection or listener is shut down and watched no longer. Closing an unknown handle does nothing.

Parameters

handle : the port to close

Errors

Outside a service worker the call traps.

Example

Capy

function SERVICE:CLOSE(props : any)
{
	port_close(u64(props.port))
}

Send CLOSE with the port handle to this service. Closing a socket locally removes it without a SERVICE:EXIT event. Closing a listener does not close connections it already accepted.

Return Values

No value. Closing a port does not wait for a child to exit.