Valkka  1.6.1
OpenSource Video Management
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
FDWriteThread Class Reference

File Descriptor Writer Thread. More...

#include <fdwritethread.h>

Inheritance diagram for FDWriteThread:
Inheritance graph
[legend]
Collaboration diagram for FDWriteThread:
Collaboration graph
[legend]

Public Member Functions

 FDWriteThread (const char *name, FrameFifoContext fifo_ctx=FrameFifoContext())
 Default constructor. More...
 
void run ()
 Main execution loop is defined here.
 
void preRun ()
 Called before entering the main execution loop, but after creating the thread.
 
void postRun ()
 Called after the main execution loop exits, but before joining the thread.
 
void preJoin ()
 Called before the thread is joined.
 
void postJoin ()
 Called after the thread has been joined.
 
void registerStreamCall (const FDWriteContext &ctx)
 API method: registers a stream // <pyapi>
 
void deregisterStreamCall (const FDWriteContext &ctx)
 API method: de-registers a stream // <pyapi>
 
void requestStopCall ()
 API method: stops the thread. More...
 
FifoFrameFiltergetFrameFilter ()
 API method: get filter for sending frames // <pyapi>
 
- Public Member Functions inherited from Thread
 Thread (const char *name)
 Default constructor. More...
 
 ~Thread ()
 Destructor:not virtual. More...
 
virtual void sendSignal (SignalContext signal_ctx)
 Send a signal to the thread.
 
virtual void sendSignalAndWait (SignalContext signal_ctx)
 Send a signal to the thread and wait for all signals to be executed.
 
void setAffinity (int i)
 API method for setting the thread affinity. More...
 
void startCall ()
 API method: starts the thread.
 
virtual void stopCall ()
 API method: stops the thread. More...
 
virtual void waitStopCall ()
 API method: waits until the thread is joined. More...
 
virtual void waitReady ()
 Wait until thread has processed all its signals.
 

Protected Member Functions

void handleSignal (const FDWriteSignalContext &signal_ctx)
 Handle an individual signal.

 
- Protected Member Functions inherited from Thread
void mainRun ()
 Does the preRun, run, postRun sequence.
 
void closeThread ()
 Sends exit signal to the thread, calls join. This method blocks until thread has exited. Set Thread::has_thread to false.
 

Protected Attributes

FDFrameFifo infifo
 Incoming frames (also signal frames) are read from here.
 
FifoFrameFilter infilter
 Write incoming frames here // TODO: add a chain of correcting FrameFilter(s)
 
BlockingFifoFrameFilter infilter_block
 Incoming frames can also be written here. If stack runs out of frames, writing will block.
 
std::vector< FDWrite * > slots_
 For fast, pointer-arithmetic-based indexing of the slots.
 
std::list< FDWrite * > fd_writes
 For iterating over the FDWrite entries.
 
fd_set write_fds
 
fd_set read_fds
 File descriptor sets used by select.
 
int nfds
 Max file descriptor number.
 
struct timeval timeout
 
- Protected Attributes inherited from Thread
std::string name
 Name of the thread.
 
bool has_thread
 true if thread has been started
 
bool stop_requested
 
bool thread_joined
 
std::mutex start_mutex
 Mutex protecting start_condition.
 
std::condition_variable start_condition
 Notified when the thread has been started.
 
std::mutex mutex
 Mutex protecting the condition variable and signal queue.
 
std::condition_variable condition
 Condition variable for the signal queue (triggered when all signals processed). Not necessarily used by all subclasses.
 
std::mutex loop_mutex
 Protects thread's main execution loop (if necessary)
 
std::deque< SignalContextsignal_fifo
 Signal queue (fifo). Redefine in child classes.
 
bool loop
 Use this boolean to control if the main loop in Thread:run should exit.
 
int core_id
 
pthread_attr_t thread_attr
 Thread attributes, pthread_* way.
 
cpu_set_t cpuset
 
pthread_t internal_thread
 

Private Member Functions

void setMaxFD ()
 
int safeGetSlot (const SlotNumber slot, FDWrite *&fd_write)
 
void registerStream (const FDWriteContext &ctx)
 
void deregisterStream (const FDWriteContext &ctx)
 

Additional Inherited Members

- Static Protected Member Functions inherited from Thread
static void * mainRun_ (void *p)
 

Detailed Description

File Descriptor Writer Thread.

Constructor & Destructor Documentation

◆ FDWriteThread()

FDWriteThread::FDWriteThread ( const char *  name,
FrameFifoContext  fifo_ctx = FrameFifoContext() 
)

Default constructor.

Parameters
nameThread name

Member Function Documentation

◆ requestStopCall()

void FDWriteThread::requestStopCall ( )
virtual

API method: stops the thread.

Like Thread::stopCall() but does not block. Waiting for the thread to join is done in Thread::waitStoppedCall()

Reimplemented from Thread.


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