Availability:C-language interface function
int Sgcclose(IOSTREAM
*s, int flags)As Sclose(),
but intended to be used from the atom garbage collector if a stream is
closed because it is garbage. The SWI-Prolog atom garbage collector
normally runs in a separate thread and thus may be unable to obtain a
lock on s if some thread lost access to the stream while it
is locked. For this situation flags may be
SIO_CLOSE_TRYLOCK
which causes Sgcclose()
to return -1 with
errno set to EDEADLK
if the stream is locked.
Alternatively, using SIO_CLOSE_FORCE
the stream is closed
and released without gaining a lock. This should be safe because the
stream is garbage and thus no thread can use the lock.
In addition, Sgcclose()
never raises a Prolog exception because Prolog interaction is not
allowed from the blob release hook and there is no meaningful way to
raise a Prolog exception from this context.