Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to kill sub_thread in OpenKode??: (6 Items)
   
How to kill sub_thread in OpenKode??  
Hi,

I had created a sub_thread in the kdMain.
But how can I kill the sub_thread in kdMain?  Is there any API to kill the sub_thread or is there any method to kill the
 sub_thread?(The kdMain will be still running.)

Thank you for your suggestion!!
Re: How to kill sub_thread in OpenKode??  
As far as I understand the spec, there is no way for one OpenKODE thread of "killing" another thread that is still 
running. The standard way of handling threads is to do a kdThreadExit/kdThreadJoin, or kdThreadDetach/kdThreadExit. You 
can always try to post a user event to that thread hoping that it will get it and respond with a kdThreadExit, but it's 
not as convenient as killing it from another thread.
Re: How to kill sub_thread in OpenKode??  
Thank you very much!

If I use the event to inform the sub thread to exit, will the thread be suspended when waiting for the event?

Or,could I use the QNX's function to terminate the sub thread?(e.g. pthread_abort(), ThreadDestroy())


Regards,
Yin
Re: How to kill sub_thread in OpenKode??  
Not necessarily. It still needs to "cooperate" and do a kdThreadExit upon reception of the user event. You can always 
use system calls like pthread_abort or ThreadDestroy, but in this case, you are no longer getting the portability that 
OpenKODE is meant to provide.
Re: How to kill sub_thread in OpenKode??  
Yes. I know.  Thank you very much!

I have another problem.

I'm doing my development with QNX Software Development Platform 6.4.1.   The kdPostThreadEvent() seems to cannot work 
well. 

If I want to post event between threads, it seems that I can only use the kdPostWindowEventQNX() right now.
Can I create numbers of kdWindow with the same EGLSurface?

Regards,
Yin
Re: How to kill sub_thread in OpenKode??  
kdPostThreadEvent isn't implemented in 6.4.1 yet. That's why you are having problems.

kdPostWindowEventQNX is, but as you know, you need a window. The ability to create multiple OpenKODE windows that share 
the same buffers is something we are considering adding as an extension. This isn't possible with the way OpenKODE Core 
does things, because normally you create an EGL surface for a native (OpenKODE) window, not the other way around.

You can always create and realize OpenKODE windows to get events going with kdPostWindowEventQNX. Unless you call 
eglCreateWindowSurface, the overhead is pretty small.