CSecondaryThread Class Reference

class CSecondaryThread : public CActive

CSecondaryThread - An active object who's sole purpose is to start the second thread and keep it alive.

Inherits from

Constructor & Destructor Documentation

CSecondaryThread(MLogArrayAccess &, TBool)

CSecondaryThread(MLogArrayAccess &aArrayAccess,
TBoolaFlushOn
)[private]

Parameters

MLogArrayAccess & aArrayAccess
TBool aFlushOn

~CSecondaryThread()

~CSecondaryThread()

Member Functions Documentation

ConstructL()

voidConstructL()[private]

Contructs and kicks off the secondary thread, while also issuing a request to be informed if the thread dies, which will run the active object

DoCancel()

voidDoCancel()[virtual]
Appends a special shutdown message into the log array. When this reaches the head and is run, it shuts down the second thread.
Note:

Logs onto second thread and waits for it to finish.

NewL(MLogArrayAccess &, TBool)

CSecondaryThread *NewL(MLogArrayAccess &aArrayAccess,
TBoolaFlushOn
)[static]

Parameters

MLogArrayAccess & aArrayAccess
TBool aFlushOn

RunError(TInt)

TInt RunError(TIntaError)[virtual]

Parameters

TInt aError

RunL()

voidRunL()[virtual]
Runs when second thread dies, and simply restarts it again.
Note:

On death a thread-death message is placed in the queue so that a user is aware this happened.

StartSecondaryThread issues a request to be informed of thread death, so starts active object again.

SignalRequestSemaphore()

voidSignalRequestSemaphore()[inline]

Increment the semaphore count to match the number of msgs in the queue.

We need to signal to the slave thread that we now have work for it. We could have added a semaphore to do this, but there is already one in the second thread that isn't being used: the request semaphore. So, instead we will use that since it is also faster. But the code looks a bit back-to-front since we are calling "RequestComplete" when we are making the request. We also have to pass in a dummy status object since in normal practice this would be part of the request completion process.

StartSecondaryThreadL(TBool)

voidStartSecondaryThreadL(TBoolaRestarting)[private]

Start the second/consumer/slave thread and issue a request to be told when it dies.

Parameters

TBool aRestarting

Member Data Documentation

MLogArrayAccess & iArrayAccess

MLogArrayAccess &iArrayAccess[private]

TBool iFlushingOn

TBool iFlushingOn[private]

RThread iSecondaryThread

RThread iSecondaryThread[private]

CShutDownMessage * iShutDownMessage

CShutDownMessage *iShutDownMessage[private]