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

  • Den::CCommonWorkerThread
Public Member Functions
~CCommonWorkerThread()
voidCFShutdownMessageReceived(const CommsFW::TCFShutdownMsg &)
voidCFUnbindMessageReceived(const CommsFW::TCFUnbindMsg &)
IMPORT_C voidCompleteSessionClose(CWorkerSession *)
IMPORT_C voidConstructL(CommsFW::TCFModuleInfo &, CShutdownWatchDog &)
CCommonDealer *Dealer()
TBool DealerShutdownComplete()
IMPORT_C voidDecProlongBindingLife()
TBool DefaultOptimalDealer()
IMPORT_C voidDestroyDealer()
IMPORT_C voidDestroyPlayer()
IMPORT_C voidDispatchL(const CommsFW::TCFMessage &, CommsFW::TWorkerId)
TBool DoDispatchL(const CommsFW::TCFMessage &, CommsFW::TWorkerId)
voidDropTransportToPeer(TInt)
IMPORT_C voidIncProlongBindingLife()
TBool IsMainThread()
IMPORT_C TBoolMaybeCompleteUnbindings()
IMPORT_C voidMaybeTriggerThreadShutdownCallback()
IMPORT_C voidOnDispatchLeave(const CommsFW::TCFMessage &, CommsFW::TWorkerId, TInt)
TBool PeerReachable(CommsFW::TWorkerId)
CCommonPitBoss &PitBoss()
CCommonPlayer *Player()
TBool PlayerShutdownComplete()
IMPORT_C voidPostMessage(CommsFW::TWorkerId, CommsFW::TCFMessage &)
IMPORT_C TIntPostMortemCleanupThreadEntry(TAny *)
IMPORT_C voidSessionShutdownComplete()
IMPORT_C voidSetDealerShutdownComplete(TBool)
IMPORT_C voidSetPlayerShutdownComplete(TBool)
IMPORT_C voidSetShuttingDown()
IMPORT_C TBoolShuttingDown()
CommsFW::CCommsTransport *Transport()
Messages::CGlobals &TransportGlobals()
voidTriggerThreadShutdownCallback()
IMPORT_C CCommonWorkerDealer *WorkerDealer()
CommsFW::TWorkerId WorkerId()
TWorkerThreadRegister *WorkerProperties(CommsFW::TWorkerId)
Protected Member Functions
CCommonWorkerThread()
voidCFBindMessageReceived(const CommsFW::TCFBindMsg &)
voidCFMessageForward(const CommsFW::TCFForwardMsg &)
IMPORT_C TIntDecodePeerId(const CommsFW::TCFSubModuleAddress *, const CommsFW::TCFSubModuleAddress *, CommsFW::TWorkerId &)
IMPORT_C voidDeleteHBufC8(TAny *)
IMPORT_C voidDetermineRoleL(HBufC8 *, TBool &, TBool &, TPlayerRole &)
voidDoCompleteUnbinding(CommsFW::TWorkerId)
CCommonDealer *DoCreateDealerL(CCommonWorkerThread *, TPlayerRole)
CCommonPitBoss *DoCreatePitBossL(CCommonWorkerThread *)
CCommonPlayer *DoCreatePlayerL(CCommonWorkerThread *, TPlayerRole)
voidDoDeterminePlayerRoleL(HBufC8 *, TPlayerRole &)
voidDoFillIntroMessage(CommsFW::TWorkerId, TWorkerIntroductionMsg &)
voidDoPostMortemCleanup()
voidDoProcessWorkerIntroductionL(const TWorkerIntroductionMsg &)
voidDoSetShuttingDown()
IMPORT_C voidMaybeCompleteUnbinding(CommsFW::TWorkerId, TBool)
voidProcessIniDataL()
IMPORT_C voidSendIntroMessage(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_CCCommonWorkerThread()[protected]

~CCommonWorkerThread()

IMPORT_C~CCommonWorkerThread()

Member Functions Documentation

CFBindMessageReceived(const CommsFW::TCFBindMsg &)

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

Parameters

const CommsFW::TCFBindMsg & aMsg

CFMessageForward(const CommsFW::TCFForwardMsg &)

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

Parameters

const CommsFW::TCFForwardMsg & aMessage

CFShutdownMessageReceived(const CommsFW::TCFShutdownMsg &)

voidCFShutdownMessageReceived(const CommsFW::TCFShutdownMsg &aMsg)

Parameters

const CommsFW::TCFShutdownMsg & aMsg

CFUnbindMessageReceived(const CommsFW::TCFUnbindMsg &)

voidCFUnbindMessageReceived(const CommsFW::TCFUnbindMsg &aMsg)

Parameters

const CommsFW::TCFUnbindMsg & aMsg

CompleteSessionClose(CWorkerSession *)

IMPORT_C voidCompleteSessionClose(CWorkerSession *aSession)

Parameters

CWorkerSession * aSession

ConstructL(CommsFW::TCFModuleInfo &, CShutdownWatchDog &)

IMPORT_C voidConstructL(CommsFW::TCFModuleInfo &aModuleInfo,
CShutdownWatchDog &aShutdownWatchDog
)

Parameters

CommsFW::TCFModuleInfo & aModuleInfo
CShutdownWatchDog & aShutdownWatchDog

Dealer()

CCommonDealer *Dealer()const [inline]

DealerShutdownComplete()

TBool DealerShutdownComplete()const [inline]

DecProlongBindingLife()

IMPORT_C voidDecProlongBindingLife()

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

IMPORT_C TIntDecodePeerId(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 voidDeleteHBufC8(TAny *aHBufC)[protected, static]

Parameters

TAny * aHBufC

DestroyDealer()

IMPORT_C voidDestroyDealer()

DestroyPlayer()

IMPORT_C voidDestroyPlayer()

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

IMPORT_C voidDetermineRoleL(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 voidDispatchL(const CommsFW::TCFMessage &aMessage,
CommsFW::TWorkerIdaSenderId
)

Parameters

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

DoCompleteUnbinding(CommsFW::TWorkerId)

voidDoCompleteUnbinding(CommsFW::TWorkerIdaWorker)[protected, pure virtual]

Parameters

CommsFW::TWorkerId aWorker

DoCreateDealerL(CCommonWorkerThread *, TPlayerRole)

CCommonDealer *DoCreateDealerL(CCommonWorkerThread *aWorkerThread,
TPlayerRoleaPlayerRole
)[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,
TPlayerRoleaPlayerRole
)[protected, pure virtual]

Parameters

CCommonWorkerThread * aWorkerThread
TPlayerRole aPlayerRole

DoDeterminePlayerRoleL(HBufC8 *, TPlayerRole &)

voidDoDeterminePlayerRoleL(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::TWorkerIdaSenderId
)[pure virtual]

Parameters

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

DoFillIntroMessage(CommsFW::TWorkerId, TWorkerIntroductionMsg &)

voidDoFillIntroMessage(CommsFW::TWorkerIdaPeerId,
TWorkerIntroductionMsg &aIntroMsg
)[protected, pure virtual]

Parameters

CommsFW::TWorkerId aPeerId
TWorkerIntroductionMsg & aIntroMsg

DoPostMortemCleanup()

voidDoPostMortemCleanup()[protected, pure virtual]

DoProcessWorkerIntroductionL(const TWorkerIntroductionMsg &)

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

Parameters

const TWorkerIntroductionMsg & aMessage

DoSetShuttingDown()

voidDoSetShuttingDown()[protected, pure virtual]

DropTransportToPeer(TInt)

voidDropTransportToPeer(TIntaPeer)

Parameters

TInt aPeer

IncProlongBindingLife()

IMPORT_C voidIncProlongBindingLife()

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 voidMaybeCompleteUnbinding(CommsFW::TWorkerIdaWorker,
TBoolaPeerIsDead
)[protected]

Parameters

CommsFW::TWorkerId aWorker
TBool aPeerIsDead

MaybeCompleteUnbindings()

IMPORT_C TBoolMaybeCompleteUnbindings()

MaybeTriggerThreadShutdownCallback()

IMPORT_C voidMaybeTriggerThreadShutdownCallback()

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

IMPORT_C voidOnDispatchLeave(const CommsFW::TCFMessage &aMessage,
CommsFW::TWorkerIdaSenderId,
TIntaFirstDispatchLeaveReason
)

Parameters

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

PeerReachable(CommsFW::TWorkerId)

TBool PeerReachable(CommsFW::TWorkerIdaPeerId)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 voidPostMessage(CommsFW::TWorkerIdaWorkerId,
CommsFW::TCFMessage &aMessage
)

Parameters

CommsFW::TWorkerId aWorkerId
CommsFW::TCFMessage & aMessage

PostMortemCleanupThreadEntry(TAny *)

IMPORT_C TIntPostMortemCleanupThreadEntry(TAny *aArg)[static]

Parameters

TAny * aArg

ProcessIniDataL()

voidProcessIniDataL()[protected]

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

IMPORT_C voidSendIntroMessage(const CommsFW::TCFModuleName &aPeerName,
CommsFW::TWorkerIdaPeerId
)[protected]

Parameters

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

SessionShutdownComplete()

IMPORT_C voidSessionShutdownComplete()

SetDealerShutdownComplete(TBool)

IMPORT_C voidSetDealerShutdownComplete(TBoolaComplete)

Parameters

TBool aComplete

SetPlayerShutdownComplete(TBool)

IMPORT_C voidSetPlayerShutdownComplete(TBoolaComplete)

Parameters

TBool aComplete

SetShuttingDown()

IMPORT_C voidSetShuttingDown()

ShuttingDown()

IMPORT_C TBoolShuttingDown()const

Transport()

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

TransportGlobals()

Messages::CGlobals &TransportGlobals()[inline]

TriggerThreadShutdownCallback()

voidTriggerThreadShutdownCallback()

WorkerDealer()

IMPORT_C CCommonWorkerDealer *WorkerDealer()const

WorkerId()

CommsFW::TWorkerId WorkerId()const [inline]

WorkerProperties(CommsFW::TWorkerId)

TWorkerThreadRegister *WorkerProperties(CommsFW::TWorkerIdaWorker)[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.