Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::ThreadSignalBlocker Class Reference

#include <signal_blocker.h>

Public Member Functions

 ThreadSignalBlocker (int sig)
 
 ThreadSignalBlocker (int sigs_count, const int sigs[])
 
 ~ThreadSignalBlocker ()
 

Detailed Description

Definition at line 20 of file signal_blocker.h.

Constructor & Destructor Documentation

◆ ThreadSignalBlocker() [1/2]

dart::ThreadSignalBlocker::ThreadSignalBlocker ( int  sig)
inlineexplicit

Definition at line 22 of file signal_blocker.h.

22 {
23 sigset_t signal_mask;
24 sigemptyset(&signal_mask);
25 sigaddset(&signal_mask, sig);
26 // Add sig to signal mask.
27 int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old);
28 USE(r);
29 ASSERT(r == 0);
30 }
#define ASSERT(E)
static void USE(T &&)
Definition: globals.h:618

◆ ThreadSignalBlocker() [2/2]

dart::ThreadSignalBlocker::ThreadSignalBlocker ( int  sigs_count,
const int  sigs[] 
)
inline

Definition at line 32 of file signal_blocker.h.

32 {
33 sigset_t signal_mask;
34 sigemptyset(&signal_mask);
35 for (int i = 0; i < sigs_count; i++) {
36 sigaddset(&signal_mask, sigs[i]);
37 }
38 // Add sig to signal mask.
39 int r = pthread_sigmask(SIG_BLOCK, &signal_mask, &old);
40 USE(r);
41 ASSERT(r == 0);
42 }

◆ ~ThreadSignalBlocker()

dart::ThreadSignalBlocker::~ThreadSignalBlocker ( )
inline

Definition at line 44 of file signal_blocker.h.

44 {
45 // Restore signal mask.
46 int r = pthread_sigmask(SIG_SETMASK, &old, nullptr);
47 USE(r);
48 ASSERT(r == 0);
49 }

The documentation for this class was generated from the following file: