Logo ROOT   6.18/05
Reference Guide
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
TGWin32ProxyBase Class Reference

Proxy classes provide thread-safe interface to global objects.

For example: TGWin32VirtualXProxy (to gVirtualX).

Proxy object creates callback object and posts a windows message to "processing thread". When windows message is received callback ("real method") is executed.

For example: gVirtualX->ClearWindow()

Howto create proxy class:

  1. Naming. name of proxy = TGWin32 + the name of "virtual base class" + Proxy

    e.g. TGWin32VirtualXProxy = TGWin32 + VirtualX + Proxy

  2. Definition of global object As example check definition and implementation of gVirtualX global object
  3. Class definition. proxy class must be inherited from "virtual base class" and TGWin32ProxyBase class. For example:

    class TGWin32VirtualX : public TVirtualX , public TGWin32ProxyBase

  4. Constructors, destructor, extra methods.

    • constructors and destructor of proxy class do nothing
    • proxy class must contain two extra static methods RealObject(), ProxyObject(). Each of them return pointer to object of virtual base class.

    For example: static TVirtualX *RealObject(); static TVirtualX *ProxyObject();

  5. Implementation TGWin32ProxyDefs.h file contains a set of macros which very simplify implementation.

Definition at line 22 of file TGWin32ProxyBase.h.

Public Member Functions

 TGWin32ProxyBase ()
 ctor More...
 
virtual ~TGWin32ProxyBase ()
 dtor More...
 
virtual void ExecuteCallBack (Bool_t sync)
 Executes all batched callbacks and the latest callback This method is executed by server thread. More...
 
ULong_t GetId () const
 
virtual Double_t GetMilliSeconds ()
 returns elapsed time in milliseconds with microseconds precision More...
 

Static Public Member Functions

static void GlobalLock ()
 lock any proxy (client thread) More...
 
static void GlobalUnlock ()
 unlock any proxy (client thread) More...
 
static Bool_t IsGloballyLocked ()
 Check the status of the lock. More...
 
static void Lock ()
 enter critical section More...
 
static Bool_t Ping ()
 send ping messsage to server thread More...
 
static void Unlock ()
 leave critical section More...
 

Static Public Attributes

static ULong_t fgMainThreadId = 0
 main thread ID More...
 
static ULong_t fgPingMessageId = 0
 ping message ID More...
 
static ULong_t fgPostMessageId = 0
 post message ID More...
 
static ULong_t fgUserThreadId = 0
 user (e.g. python) thread ID More...
 

Protected Member Functions

virtual Bool_t ForwardCallBack (Bool_t sync)
 if sync is kTRUE: More...
 
virtual void SendExitMessage ()
 send exit message to server thread More...
 

Protected Attributes

Int_t fBatchLimit
 batch limit More...
 
TGWin32CallBack fCallBack
 callback function (executed by "main" thread) More...
 
ULong_t fId
 thread id. There is one proxy per client thread More...
 
Bool_t fIsVirtualX
 true if actual TVirtualX implementation More...
 
TListfListOfCallBacks
 list of callbacks (used for batch processing) More...
 
voidfParam
 arguments passed to/from callback function More...
 
TGWin32ProxyBasePrivate * fPimpl
 very private data More...
 

Static Protected Attributes

static Long_t fgLock = 0
 fgLock=1 - all client threads locked More...
 
static UInt_t fMaxResponseTime = 0
 max period for waiting response from server thread More...
 

Friends

class TGWin32
 
class TGWin32GL
 

#include <TGWin32ProxyBase.h>

Inheritance diagram for TGWin32ProxyBase:
[legend]

Constructor & Destructor Documentation

◆ TGWin32ProxyBase()

TGWin32ProxyBase::TGWin32ProxyBase ( )

ctor

Definition at line 136 of file TGWin32ProxyBase.cxx.

◆ ~TGWin32ProxyBase()

TGWin32ProxyBase::~TGWin32ProxyBase ( )
virtual

dtor

Definition at line 153 of file TGWin32ProxyBase.cxx.

Member Function Documentation

◆ ExecuteCallBack()

void TGWin32ProxyBase::ExecuteCallBack ( Bool_t  sync)
virtual

Executes all batched callbacks and the latest callback This method is executed by server thread.

Definition at line 235 of file TGWin32ProxyBase.cxx.

◆ ForwardCallBack()

Bool_t TGWin32ProxyBase::ForwardCallBack ( Bool_t  sync)
protectedvirtual

if sync is kTRUE:

  • post message to main thread.
  • execute callbacks from fListOfCallBacks
  • wait for response else
  • add callback to fListOfCallBacks

returns kTRUE if callback execution is delayed (batched)

Definition at line 262 of file TGWin32ProxyBase.cxx.

◆ GetId()

ULong_t TGWin32ProxyBase::GetId ( ) const
inline

Definition at line 58 of file TGWin32ProxyBase.h.

◆ GetMilliSeconds()

Double_t TGWin32ProxyBase::GetMilliSeconds ( )
virtual

returns elapsed time in milliseconds with microseconds precision

Definition at line 207 of file TGWin32ProxyBase.cxx.

◆ GlobalLock()

void TGWin32ProxyBase::GlobalLock ( )
static

lock any proxy (client thread)

Definition at line 181 of file TGWin32ProxyBase.cxx.

◆ GlobalUnlock()

void TGWin32ProxyBase::GlobalUnlock ( )
static

unlock any proxy (client thread)

Definition at line 190 of file TGWin32ProxyBase.cxx.

◆ IsGloballyLocked()

Bool_t TGWin32ProxyBase::IsGloballyLocked ( )
static

Check the status of the lock.

Definition at line 327 of file TGWin32ProxyBase.cxx.

◆ Lock()

void TGWin32ProxyBase::Lock ( )
static

enter critical section

Definition at line 165 of file TGWin32ProxyBase.cxx.

◆ Ping()

Bool_t TGWin32ProxyBase::Ping ( )
static

send ping messsage to server thread

Definition at line 199 of file TGWin32ProxyBase.cxx.

◆ SendExitMessage()

void TGWin32ProxyBase::SendExitMessage ( )
protectedvirtual

send exit message to server thread

Definition at line 335 of file TGWin32ProxyBase.cxx.

◆ Unlock()

void TGWin32ProxyBase::Unlock ( )
static

leave critical section

Definition at line 173 of file TGWin32ProxyBase.cxx.

Friends And Related Function Documentation

◆ TGWin32

friend class TGWin32
friend

Definition at line 23 of file TGWin32ProxyBase.h.

◆ TGWin32GL

friend class TGWin32GL
friend

Definition at line 24 of file TGWin32ProxyBase.h.

Member Data Documentation

◆ fBatchLimit

Int_t TGWin32ProxyBase::fBatchLimit
protected

batch limit

Definition at line 28 of file TGWin32ProxyBase.h.

◆ fCallBack

TGWin32CallBack TGWin32ProxyBase::fCallBack
protected

callback function (executed by "main" thread)

Definition at line 30 of file TGWin32ProxyBase.h.

◆ fgLock

Long_t TGWin32ProxyBase::fgLock = 0
staticprotected

fgLock=1 - all client threads locked

Definition at line 35 of file TGWin32ProxyBase.h.

◆ fgMainThreadId

ULong_t TGWin32ProxyBase::fgMainThreadId = 0
static

main thread ID

Definition at line 43 of file TGWin32ProxyBase.h.

◆ fgPingMessageId

ULong_t TGWin32ProxyBase::fgPingMessageId = 0
static

ping message ID

Definition at line 42 of file TGWin32ProxyBase.h.

◆ fgPostMessageId

ULong_t TGWin32ProxyBase::fgPostMessageId = 0
static

post message ID

Definition at line 41 of file TGWin32ProxyBase.h.

◆ fgUserThreadId

ULong_t TGWin32ProxyBase::fgUserThreadId = 0
static

user (e.g. python) thread ID

Definition at line 44 of file TGWin32ProxyBase.h.

◆ fId

ULong_t TGWin32ProxyBase::fId
protected

thread id. There is one proxy per client thread

Definition at line 32 of file TGWin32ProxyBase.h.

◆ fIsVirtualX

Bool_t TGWin32ProxyBase::fIsVirtualX
protected

true if actual TVirtualX implementation

Definition at line 33 of file TGWin32ProxyBase.h.

◆ fListOfCallBacks

TList* TGWin32ProxyBase::fListOfCallBacks
protected

list of callbacks (used for batch processing)

Definition at line 29 of file TGWin32ProxyBase.h.

◆ fMaxResponseTime

UInt_t TGWin32ProxyBase::fMaxResponseTime = 0
staticprotected

max period for waiting response from server thread

Definition at line 34 of file TGWin32ProxyBase.h.

◆ fParam

void* TGWin32ProxyBase::fParam
protected

arguments passed to/from callback function

Definition at line 31 of file TGWin32ProxyBase.h.

◆ fPimpl

TGWin32ProxyBasePrivate* TGWin32ProxyBase::fPimpl
protected

very private data

Definition at line 27 of file TGWin32ProxyBase.h.


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