Den::CCommonWorkerThread Class Reference

class Den::CCommonWorkerThread : public CBase

The Worker Thread is the holder of the relevant ESock objects in the CPM instance, e.g. the PitBoss, the Dealer and the Player (depending on configuration). It is also in charge of inter-thread communication as it holds the object enabling communication with the RootServer ( CWorkerRootServChannelHandler ) and a list of objects for communication with other Worker threads (CWorkerTransport).

CWorkerRootServChannelHandler CWorkerTransport

Inherits from

Public Member Functions
~CCommonWorkerThread ()
void CFShutdownMessageReceived (const CommsFW::TCFShutdownMsg &)
void CFUnbindMessageReceived (const CommsFW::TCFUnbindMsg &)
IMPORT_C void CompleteSessionClose ( CWorkerSession *)
IMPORT_C void ConstructL ( CommsFW::TCFModuleInfo &, CShutdownWatchDog &)
CCommonDealer * Dealer ()
TBool DealerShutdownComplete ()
IMPORT_C void DecProlongBindingLife ()
TBool DefaultOptimalDealer ()
IMPORT_C void DestroyDealer ()
IMPORT_C void DestroyPlayer ()
IMPORT_C void DispatchL (const CommsFW::TCFMessage &, CommsFW::TWorkerId )
TBool DoDispatchL (const CommsFW::TCFMessage &, CommsFW::TWorkerId )
void DropTransportToPeer ( TInt )
IMPORT_C void IncProlongBindingLife ()
TBool IsMainThread ()
IMPORT_C TBool MaybeCompleteUnbindings ()
IMPORT_C void MaybeTriggerThreadShutdownCallback ()
IMPORT_C void OnDispatchLeave (const CommsFW::TCFMessage &, CommsFW::TWorkerId , TInt )
TBool PeerReachable ( CommsFW::TWorkerId )
CCommonPitBoss & PitBoss ()
CCommonPlayer * Player ()
TBool PlayerShutdownComplete ()
IMPORT_C void PostMessage ( CommsFW::TWorkerId , CommsFW::TCFMessage &)
IMPORT_C TInt PostMortemCleanupThreadEntry ( TAny *)
IMPORT_C void SessionShutdownComplete ()
IMPORT_C void SetDealerShutdownComplete ( TBool )
IMPORT_C void SetPlayerShutdownComplete ( TBool )
IMPORT_C void SetShuttingDown ()
IMPORT_C TBool ShuttingDown ()
CommsFW::CCommsTransport * Transport ()
Messages::CGlobals & TransportGlobals ()
void TriggerThreadShutdownCallback ()
IMPORT_C CCommonWorkerDealer * WorkerDealer ()
CommsFW::TWorkerId WorkerId ()
TWorkerThreadRegister * WorkerProperties ( CommsFW::TWorkerId )
Protected Member Functions
CCommonWorkerThread ()
void CFBindMessageReceived (const CommsFW::TCFBindMsg &)
void CFMessageForward (const CommsFW::TCFForwardMsg &)
IMPORT_C TInt DecodePeerId (const CommsFW::TCFSubModuleAddress *, const CommsFW::TCFSubModuleAddress *, CommsFW::TWorkerId &)
IMPORT_C void DeleteHBufC8 ( TAny *)
IMPORT_C void DetermineRoleL ( HBufC8 *, TBool &, TBool &, TPlayerRole &)
void DoCompleteUnbinding ( CommsFW::TWorkerId )
CCommonDealer * DoCreateDealerL ( CCommonWorkerThread *, TPlayerRole )
CCommonPitBoss * DoCreatePitBossL ( CCommonWorkerThread *)
CCommonPlayer * DoCreatePlayerL ( CCommonWorkerThread *, TPlayerRole )
void DoDeterminePlayerRoleL ( HBufC8 *, TPlayerRole &)
void DoFillIntroMessage ( CommsFW::TWorkerId , TWorkerIntroductionMsg &)
void DoPostMortemCleanup ()
void DoProcessWorkerIntroductionL (const TWorkerIntroductionMsg &)
void DoSetShuttingDown ()
IMPORT_C void MaybeCompleteUnbinding ( CommsFW::TWorkerId , TBool )
void ProcessIniDataL ()
IMPORT_C void SendIntroMessage (const CommsFW::TCFModuleName &, CommsFW::TWorkerId )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Protected Attributes
CWorkerRootServChannelHandler * iChannelHandler
CCommonDealer * iDealer
TBool iDealerShutdownComplete
TBool iDefaultOptimalDealer
Messages::CGlobals * iGlobals
CCommonPitBoss * iPitBoss
CCommonPlayer * iPlayer
TBool iPlayerShutdownComplete
TInt iProlongBindingLife
CShutdownWatchDog * iShutdownWatchDog
CommsFW::CCommsTransport * iTransport
CommsFW::TWorkerId iWorkerId
CWorkerRegister * iWorkerRegister
TBool iWorkerShuttingDown
Private Attributes
TInt iFailRate
RAllocator::TAllocFail iFailType

Constructor & Destructor Documentation

CCommonWorkerThread()

IMPORT_C CCommonWorkerThread ( ) [protected]

~CCommonWorkerThread()

IMPORT_C ~CCommonWorkerThread ( )

Member Functions Documentation

CFBindMessageReceived(const CommsFW::TCFBindMsg &)

void CFBindMessageReceived ( const CommsFW::TCFBindMsg & aMsg ) [protected, pure virtual]

Parameters

const CommsFW::TCFBindMsg & aMsg

CFMessageForward(const CommsFW::TCFForwardMsg &)

void CFMessageForward ( const CommsFW::TCFForwardMsg & aMessage ) [protected, pure virtual]

Parameters

const CommsFW::TCFForwardMsg & aMessage

CFShutdownMessageReceived(const CommsFW::TCFShutdownMsg &)

void CFShutdownMessageReceived ( const CommsFW::TCFShutdownMsg & aMsg )

Parameters

const CommsFW::TCFShutdownMsg & aMsg

CFUnbindMessageReceived(const CommsFW::TCFUnbindMsg &)

void CFUnbindMessageReceived ( const CommsFW::TCFUnbindMsg & aMsg )

Parameters

const CommsFW::TCFUnbindMsg & aMsg

CompleteSessionClose(CWorkerSession *)

IMPORT_C void CompleteSessionClose ( CWorkerSession * aSession )

Parameters

CWorkerSession * aSession

ConstructL(CommsFW::TCFModuleInfo &, CShutdownWatchDog &)

IMPORT_C void ConstructL ( CommsFW::TCFModuleInfo & aModuleInfo,
CShutdownWatchDog & aShutdownWatchDog
)

Parameters

CommsFW::TCFModuleInfo & aModuleInfo
CShutdownWatchDog & aShutdownWatchDog

Dealer()

CCommonDealer * Dealer ( ) const [inline]

DealerShutdownComplete()

TBool DealerShutdownComplete ( ) const [inline]

DecProlongBindingLife()

IMPORT_C void DecProlongBindingLife ( )

DecodePeerId(const CommsFW::TCFSubModuleAddress *, const CommsFW::TCFSubModuleAddress *, CommsFW::TWorkerId &)

IMPORT_C TInt DecodePeerId ( const CommsFW::TCFSubModuleAddress * aSubModule1,
const CommsFW::TCFSubModuleAddress * aSubModule2,
CommsFW::TWorkerId & aPeerId
) [protected]

Parameters

const CommsFW::TCFSubModuleAddress * aSubModule1
const CommsFW::TCFSubModuleAddress * aSubModule2
CommsFW::TWorkerId & aPeerId

DefaultOptimalDealer()

TBool DefaultOptimalDealer ( ) const [inline]

DeleteHBufC8(TAny *)

IMPORT_C void DeleteHBufC8 ( TAny * aHBufC ) [protected, static]

Parameters

TAny * aHBufC

DestroyDealer()

IMPORT_C void DestroyDealer ( )

DestroyPlayer()

IMPORT_C void DestroyPlayer ( )

DetermineRoleL(HBufC8 *, TBool &, TBool &, TPlayerRole &)

IMPORT_C void DetermineRoleL ( HBufC8 * aIniData,
TBool & aIsDealer,
TBool & aIsPlayer,
TPlayerRole & aPlayerRole
) [protected]

Parameters

HBufC8 * aIniData
TBool & aIsDealer
TBool & aIsPlayer
TPlayerRole & aPlayerRole

DispatchL(const CommsFW::TCFMessage &, CommsFW::TWorkerId)

IMPORT_C void DispatchL ( const CommsFW::TCFMessage & aMessage,
CommsFW::TWorkerId aSenderId
)

Parameters

const CommsFW::TCFMessage & aMessage
CommsFW::TWorkerId aSenderId

DoCompleteUnbinding(CommsFW::TWorkerId)

void DoCompleteUnbinding ( CommsFW::TWorkerId aWorker ) [protected, pure virtual]

Parameters

CommsFW::TWorkerId aWorker

DoCreateDealerL(CCommonWorkerThread *, TPlayerRole)

CCommonDealer * DoCreateDealerL ( CCommonWorkerThread * aWorkerThread,
TPlayerRole aPlayerRole
) [protected, pure virtual]

Parameters

CCommonWorkerThread * aWorkerThread
TPlayerRole aPlayerRole

DoCreatePitBossL(CCommonWorkerThread *)

CCommonPitBoss * DoCreatePitBossL ( CCommonWorkerThread * aWorkerThread ) [protected, pure virtual]

Parameters

CCommonWorkerThread * aWorkerThread

DoCreatePlayerL(CCommonWorkerThread *, TPlayerRole)

CCommonPlayer * DoCreatePlayerL ( CCommonWorkerThread * aWorkerThread,
TPlayerRole aPlayerRole
) [protected, pure virtual]

Parameters

CCommonWorkerThread * aWorkerThread
TPlayerRole aPlayerRole

DoDeterminePlayerRoleL(HBufC8 *, TPlayerRole &)

void DoDeterminePlayerRoleL ( HBufC8 * aIniData,
TPlayerRole & aPlayerRole
) [protected, pure virtual]

Parameters

HBufC8 * aIniData
TPlayerRole & aPlayerRole

DoDispatchL(const CommsFW::TCFMessage &, CommsFW::TWorkerId)

TBool DoDispatchL ( const CommsFW::TCFMessage & aMessage,
CommsFW::TWorkerId aSenderId
) [pure virtual]

Parameters

const CommsFW::TCFMessage & aMessage
CommsFW::TWorkerId aSenderId

DoFillIntroMessage(CommsFW::TWorkerId, TWorkerIntroductionMsg &)

void DoFillIntroMessage ( CommsFW::TWorkerId aPeerId,
TWorkerIntroductionMsg & aIntroMsg
) [protected, pure virtual]

Parameters

CommsFW::TWorkerId aPeerId
TWorkerIntroductionMsg & aIntroMsg

DoPostMortemCleanup()

void DoPostMortemCleanup ( ) [protected, pure virtual]

DoProcessWorkerIntroductionL(const TWorkerIntroductionMsg &)

void DoProcessWorkerIntroductionL ( const TWorkerIntroductionMsg & aMessage ) [protected, pure virtual]

Parameters

const TWorkerIntroductionMsg & aMessage

DoSetShuttingDown()

void DoSetShuttingDown ( ) [protected, pure virtual]

DropTransportToPeer(TInt)

void DropTransportToPeer ( TInt aPeer )

Parameters

TInt aPeer

IncProlongBindingLife()

IMPORT_C void IncProlongBindingLife ( )

IsMainThread()

TBool IsMainThread ( ) [inline]

Use this to discover whether this Worker Thread is EMainThread ("Esock_Main") which is the main Dealer also containing the PitBoss. TWorkerThreadInfo

MaybeCompleteUnbinding(CommsFW::TWorkerId, TBool)

IMPORT_C void MaybeCompleteUnbinding ( CommsFW::TWorkerId aWorker,
TBool aPeerIsDead
) [protected]

Parameters

CommsFW::TWorkerId aWorker
TBool aPeerIsDead

MaybeCompleteUnbindings()

IMPORT_C TBool MaybeCompleteUnbindings ( )

MaybeTriggerThreadShutdownCallback()

IMPORT_C void MaybeTriggerThreadShutdownCallback ( )

OnDispatchLeave(const CommsFW::TCFMessage &, CommsFW::TWorkerId, TInt)

IMPORT_C void OnDispatchLeave ( const CommsFW::TCFMessage & aMessage,
CommsFW::TWorkerId aSenderId,
TInt aFirstDispatchLeaveReason
)

Parameters

const CommsFW::TCFMessage & aMessage
CommsFW::TWorkerId aSenderId
TInt aFirstDispatchLeaveReason

PeerReachable(CommsFW::TWorkerId)

TBool PeerReachable ( CommsFW::TWorkerId aPeerId ) const [inline]

Parameters

CommsFW::TWorkerId aPeerId

PitBoss()

CCommonPitBoss & PitBoss ( ) const [inline]
Return the pointer to the domain PitBoss. This will be initialised when:
  1. If this is Main thread: In CCommonWorkerThread::ConstructL(TCFModuleInfo* aModuleInfo).
    1. In other common worker threads: When receiving TWorkerMsg::EMainIntroduction.

Player()

CCommonPlayer * Player ( ) const [inline]

PlayerShutdownComplete()

TBool PlayerShutdownComplete ( ) const [inline]

PostMessage(CommsFW::TWorkerId, CommsFW::TCFMessage &)

IMPORT_C void PostMessage ( CommsFW::TWorkerId aWorkerId,
CommsFW::TCFMessage & aMessage
)

Parameters

CommsFW::TWorkerId aWorkerId
CommsFW::TCFMessage & aMessage

PostMortemCleanupThreadEntry(TAny *)

IMPORT_C TInt PostMortemCleanupThreadEntry ( TAny * aArg ) [static]

Parameters

TAny * aArg

ProcessIniDataL()

void ProcessIniDataL ( ) [protected]

SendIntroMessage(const CommsFW::TCFModuleName &, CommsFW::TWorkerId)

IMPORT_C void SendIntroMessage ( const CommsFW::TCFModuleName & aPeerName,
CommsFW::TWorkerId aPeerId
) [protected]

Parameters

const CommsFW::TCFModuleName & aPeerName
CommsFW::TWorkerId aPeerId

SessionShutdownComplete()

IMPORT_C void SessionShutdownComplete ( )

SetDealerShutdownComplete(TBool)

IMPORT_C void SetDealerShutdownComplete ( TBool aComplete )

Parameters

TBool aComplete

SetPlayerShutdownComplete(TBool)

IMPORT_C void SetPlayerShutdownComplete ( TBool aComplete )

Parameters

TBool aComplete

SetShuttingDown()

IMPORT_C void SetShuttingDown ( )

ShuttingDown()

IMPORT_C TBool ShuttingDown ( ) const

Transport()

CommsFW::CCommsTransport * Transport ( ) const [inline]

TransportGlobals()

Messages::CGlobals & TransportGlobals ( ) [inline]

TriggerThreadShutdownCallback()

void TriggerThreadShutdownCallback ( )

WorkerDealer()

IMPORT_C CCommonWorkerDealer * WorkerDealer ( ) const

WorkerId()

CommsFW::TWorkerId WorkerId ( ) const [inline]

WorkerProperties(CommsFW::TWorkerId)

TWorkerThreadRegister * WorkerProperties ( CommsFW::TWorkerId aWorker ) [inline]

Parameters

CommsFW::TWorkerId aWorker

Member Data Documentation

CWorkerRootServChannelHandler * iChannelHandler

CWorkerRootServChannelHandler * iChannelHandler [protected]

This is the handler used for bi-directional communication with the Root Server.

CCommonDealer * iDealer

CCommonDealer * iDealer [protected]

TBool iDealerShutdownComplete

TBool iDealerShutdownComplete [protected]

Set by the Dealer instance to signal to the Worker Thread that it has finished with the shutdown bookkeeping and is ready to be deleted.

TBool iDefaultOptimalDealer

TBool iDefaultOptimalDealer [protected]

TInt iFailRate

TInt iFailRate [private]

RAllocator::TAllocFail iFailType

RAllocator::TAllocFail iFailType [private]

Messages::CGlobals * iGlobals

Messages::CGlobals * iGlobals [protected]

CCommonPitBoss * iPitBoss

CCommonPitBoss * iPitBoss [protected]

CCommonPlayer * iPlayer

CCommonPlayer * iPlayer [protected]

TBool iPlayerShutdownComplete

TBool iPlayerShutdownComplete [protected]

Set by the Player instance to signal to the Worker Thread that it has finished with the shutdown bookkeeping and is ready to be deleted.

TInt iProlongBindingLife

TInt iProlongBindingLife [protected]

If the value of this TInt is larger than 0 any unbind requests will not be served, but postponed until iProlongBindingLife is 0. This is to ensure that if e.g. a TWorkerMsg::ECleanupDeadPeer or TPlayerMsg::ESessionClose is received they will be fully served before completing any unbind and thus deleting channel handlers.

CShutdownWatchDog * iShutdownWatchDog

CShutdownWatchDog * iShutdownWatchDog [protected]

CommsFW::CCommsTransport * iTransport

CommsFW::CCommsTransport * iTransport [protected]

CommsFW::TWorkerId iWorkerId

CommsFW::TWorkerId iWorkerId [protected]

Indentification of this thread. No other instance must have the same id. TWorkerThreadInfo

CWorkerRegister * iWorkerRegister

CWorkerRegister * iWorkerRegister [protected]

TBool iWorkerShuttingDown

TBool iWorkerShuttingDown [protected]

Set when a CommsFW::TCFShutdownMsg is received from the Root Server.