All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | List of all members
LxS::System::ServiceThread Class Reference

class representing background th

#include <servicethread.hpp>

Collaboration diagram for LxS::System::ServiceThread:
Collaboration graph

Public Member Functions

int GetCurrentPriority ()
 ServiceThread ()
 default constructor
int TerminateThread ()
 delete main loop object, kill thread execution;
int DetatchThread ()
 invalidate handle and terminate after execution of last call. Self-cleanup.
bool QueueEmpty ()
 check if no calls are enqueued
bool No0PriorityCalls ()
 if no calls of 0 priority are enqueued. 0 is the highest possible priority
bool QueueMore1 ()
 more than one function ("currently executed") is enqueued
void ClearQueue ()
int EnqueueCall (ServiceFunction call, int priority=0)
 Enquene call for execution.. 0, default priority is the highest.
 ~ServiceThread ()
 default destructor

Detailed Description

class representing background thread

threading model in LxS is formulated as set of background ("service") threads (as opposed to main (OpenGL processing)) thread. Each thread has queue of functions, it was ordered to execute, and it than gradually executes them

  Any thread                     Background thread
      |                           |
      |                           |  <-----------.
      |                           |              |

t->EnqueueCall()-—>func_queue<-—MainThreadLoop | | ^ ^ | / | push_back pop_front | / |/ execute |/--------—' | |

This is designed so that any time-consuming function (which therefore cannot be executed in main thread) can be executed in background without creating too many threads, and with added benefit of simplified and efficient thread management.

Member Function Documentation

int LxS::System::ServiceThread::GetCurrentPriority ( )

priority of currently executed call; if thread is idle, 0 is returned, otherwise nonnegative number

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