tags:

views:

305

answers:

1

I'm getting a little frustrated with the definition of Thread Termination they have in Symbian. Please, correct me if I am wrong. Threads in Symbian OS can end their life in 4 different ways:

  1. When thread function exits normally;
  2. When User::Exit() is called for current thread;
  3. When thread is forced to die by calling RThread::Kill() or RThread::Terminate();
  4. When panic has been raised on the thread by User::Panic

My question is: which one of these four situations corresponds to 'thread termination'?

PS: I came up with this question when while exploring "critical threads" definition in Symbian documentation. Maybe this extract could be helpful.

+2  A: 

All of them. The SDK documentation specifies it quite exactly:

The death of a thread (and any subsequent notifications etc.) is effectively just an indication that the thread will never execute any more code; it does not guarantee that the operating system has yet finished removing the thread.

Now, if you're inspecting RThread::ExitType, you'll find the following information:

EExitKill The thread or process has ended as a result of a kill, i.e. Kill() has been called on the RThread or RProcess handle. Or a thread was ended as a result of calling User::Exit().

EExitTerminate The thread or process has ended as a result of a terminate, i.e. Terminate() has been called on the RThread or RProcess handle.

EExitPanic The thread or process has been panicked.

EExitPending The thread or process is alive.

For cases 1, 2 and Kill in case 3, you'll get EExitKill. Other cases are quite self-explanatory.

laalto
>>> For cases 1, 2 and Kill in case 3, you'll get EExitKillShould this be true, than it would be impossible to determine if thread has died normally - though thread function exit. Which is crucial, because in case of abnormal termination thread resources are not disposed properly.
nixau
Kill is a normal termination; Terminate is abnormal.
laalto
SDK documentation states that there are no difference between them - just logical, Kill is a nice guy, while Terminate is a mean one. Difference appears only in ExitType category.
nixau
And no matter with method is called Kill or Terminate - resources are not disposed properly.
nixau