Remoto - VFS: VFS_threadthread Class Reference
Remoto - VFS
VFS_threadthread Class Reference

A subclass of QThread, which provides an event loop in a different thread. More...

#include <VFS_thread.h>

Inheritance diagram for VFS_threadthread:

Signals

void creationFailed ()
 If _node creation was not possible, this signal is emitted. More...
 
void nodeCreated (VFS_node *node)
 Once the _node has been created, this signals back to the owning VFS_thread of its existence. More...
 

Public Member Functions

 VFS_threadthread (VFS_node *p, QDomElement nodeConfig, QVariantMap env, bool printConfig)
 
 ~VFS_threadthread ()
 
void run ()
 Run the QThread event loop. More...
 

Public Attributes

QVariantMap _env
 The environment. More...
 
VFS_node_node
 The root VFS_node running in the new thread. More...
 
QDomElement _nodeConfig
 XML config node. More...
 
bool _printConfig
 A debug setting, used to make sure contexts are correct. More...
 

Detailed Description

A subclass of QThread, which provides an event loop in a different thread.

This is created by VFS_thread, and receives configuration data passed from a config file.

Definition at line 10 of file VFS_thread.h.

Constructor & Destructor Documentation

◆ VFS_threadthread()

VFS_threadthread::VFS_threadthread ( VFS_node p,
QDomElement  nodeConfig,
QVariantMap  env,
bool  printConfig 
)
explicit
Parameters
pThe owning VFS_thread
nodeConfigThe XML configuration node
envThe current environment
printConfigA debug setting, used to make sure contexts are correct

Create the VFS_threadthread, but don't run it yet. The VFS_node for this thread will not be created until VFS_threadthread::run() is called.

Definition at line 344 of file VFS_thread.cpp.

◆ ~VFS_threadthread()

VFS_threadthread::~VFS_threadthread ( )

Definition at line 353 of file VFS_thread.cpp.

Member Function Documentation

◆ creationFailed

void VFS_threadthread::creationFailed ( )
signal

If _node creation was not possible, this signal is emitted.

Warning
Nothing is listening for this at the moment!

◆ nodeCreated

void VFS_threadthread::nodeCreated ( VFS_node node)
signal

Once the _node has been created, this signals back to the owning VFS_thread of its existence.

◆ run()

void VFS_threadthread::run ( )

Run the QThread event loop.

The lifetime of this function is the lifetime of the thread.

VFS_creator::constructNode() is called with the config data to attempt to create the _node. If creation is successful, the _node is mount()ed and the thread blocks until the VFS_creator::outstanding semaphore has synchronized. QThread::exec() is called to start the event loop, and the method blocks until the thread completes.

If _node creation was not possible, the error is logged and creationFailed() is emitted. The event loop does not start, run() will finish, and therefore the QThread will emit finished() and trigger deletion of the VFS_thread. Semaphores are released so initialization can continue.

Note that the thread attribute is removed from the config line to prevent an infinite loop on thread creation.

Definition at line 380 of file VFS_thread.cpp.

Member Data Documentation

◆ _env

QVariantMap VFS_threadthread::_env

The environment.

Definition at line 21 of file VFS_thread.h.

◆ _node

VFS_node* VFS_threadthread::_node

The root VFS_node running in the new thread.

Definition at line 24 of file VFS_thread.h.

◆ _nodeConfig

QDomElement VFS_threadthread::_nodeConfig

XML config node.

Definition at line 20 of file VFS_thread.h.

◆ _printConfig

bool VFS_threadthread::_printConfig

A debug setting, used to make sure contexts are correct.

Definition at line 22 of file VFS_thread.h.


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