TSDuck v3.38-3691
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::UserInterrupt Class Reference

An instance of this class handles the Ctrl+C user interrupt. More...

#include <tsUserInterrupt.h>

Inheritance diagram for ts::UserInterrupt:
Collaboration diagram for ts::UserInterrupt:

Public Member Functions

 UserInterrupt (InterruptHandler *handler, bool one_shot, bool auto_activate)
 Constructor.
 
virtual ~UserInterrupt () override
 Destructor, auto-deactivate.
 
void activate ()
 Activate this interrupt handler.
 
void deactivate ()
 Deactivate this interrupt handler.
 
bool isActive () const
 Check if this interrupt handler is active.
 
bool isInterrupted () const
 Check if this interrupt was triggered.
 
void resetInterrupted ()
 Reset interrupt state.
 

Detailed Description

An instance of this class handles the Ctrl+C user interrupt.

There must be at most one active instance at a time.

Can be used in two ways:

Constructor & Destructor Documentation

◆ UserInterrupt()

ts::UserInterrupt::UserInterrupt ( InterruptHandler handler,
bool  one_shot,
bool  auto_activate 
)

Constructor.

Parameters
[in]handlerAddress of interrupt handler. Can be null.
[in]one_shotIf true, the interrupt will be handled only once, the second time the process will be terminated.
[in]auto_activateIf true, the interrupt handling is immediately activated.

Member Function Documentation

◆ isActive()

bool ts::UserInterrupt::isActive ( ) const
inline

Check if this interrupt handler is active.

Returns
True if this interrupt handler is active.

◆ isInterrupted()

bool ts::UserInterrupt::isInterrupted ( ) const
inline

Check if this interrupt was triggered.

Returns
True if this interrupt handler was triggered.

◆ resetInterrupted()

void ts::UserInterrupt::resetInterrupted ( )
inline

Reset interrupt state.

Now, isInterrupted() will return false, until the next time the interrupt is triggered.

◆ activate()

void ts::UserInterrupt::activate ( )

Activate this interrupt handler.

Only one handler can be active at a time. This method does nothing if this handler or another handler is already active.


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