Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
PTHREAD_SIGNALS_BLOCK_NP(3) Library Functions ManuaPTHREAD_SIGNALS_BLOCK_NP(3)

NAME
       pthread_signals_block_np,  pthread_signals_unblock_np --	fast asynchro-
       nous signals blocking and unblocking

LIBRARY
       POSIX Threads Library (libpthread, -lpthread)

SYNOPSIS
       #include	<pthread_np.h>

       void
       pthread_signals_block_np(void);

       void
       pthread_signals_unblock_np(void);

DESCRIPTION
       The pthread_signals_block_np() and  pthread_signals_unblock_np()	 func-
       tions  provide user programs an interface to the	fast asynchronous sig-
       nals blocking facility sigfastblock(2).

       Blocking	signals	with pthread_signals_block_np()	disables  delivery  of
       any  asynchronous signal, until unblocked.  Signal blocking establishes
       a critical section where	the execution flow of the thread cannot	be di-
       verted into a signal handler.  Blocking signals is  fast,  it  is  per-
       formed  by  a  single memory write into a location established with the
       kernel.

       Synchronous signal delivery cannot be  blocked  in  general,  including
       with these functions.

       The  blocked state established by the pthread_signals_block_np()	is not
       completely POSIX-compliant.  Specifically, system calls executed	 while
       in  a  blocked section, might abort sleep and return EINTR upon queuing
       of an asynchronous signal to the	thread,	but the	signal handler is  not
       called until the	last unblock is	done.

       Calls  to  pthread_signals_block_np  can	be nested, and must be comple-
       mented by an equal count	of calls to pthread_signals_unblock_np to  re-
       turn the	calling	thread to the standard mode of signal receiving.

       An  example  use	of these function might	be the construction of the CPU
       state that cannot be done atomically, and which includes	 stages	 where
       the state of the	thread is not ABI compliant.  If a signal is delivered
       while  such state is not	yet finished, signal handlers would misbehave.
       Using standard functions	(sigprocmask())	to establish critical  section
       might  be  much	slower,	 because  sigprocmask()	 is system call, while
       pthread_signals_block_np() consists of a	single atomic memory write.

RETURN VALUES
       The functions do	not return a value.

ERRORS
       There are no errors reported by the functions.

SEE ALSO
       sigfastblock(2),	sigprocmask(2),	pthread_sigmask(3), pthread_np(3)

FreeBSD	15.0			 May 16, 2025	   PTHREAD_SIGNALS_BLOCK_NP(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=pthread_signals_block_np&sektion=3&manpath=FreeBSD+15.0-RELEASE+and+Ports>

home | help