Re: Threads
"Mahmoud Hammoud" <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Message-ID | <[email protected]> |
Thanks a lot Greg for your time and support. So are HXEvent's functions GetMessage and PostMessage the right things to look at in my case? What about the Wait() and SignalEvent() functions? How should they exacly be used? A small example would be very helpful. Regards, Mahmoud On Fri, Aug 29, 2008 at 7:29 PM, Greg Wright <[email protected]> wrote: > Mahmoud Hammoud wrote: > >> Thanks Greg, >> I took a look at the code and now I think I managed to create my own >> thread to perform some operations in the background. Just a small question >> on the subject: Suppose I want to know if a specific event has occured in >> that thread (e.g. a condition is now satisfied, or a specific message has >> been received...), is there a straightforward way to do that? >> > > Sounds like you just need any of a number of inter-thread communication > techniques. Depending on what you need you can use mutex-guarded > member vars, events, semaphores. We also often use the scheduler > to arrange callbacks onto the main app thread. You can use this to > call back into some class when a certain event happens. Take a look > at the helix code for Scheduler->, RelativeEnter and other calls. > > --greg. > > Thanks again, >> Mahmoud >> >> On Wed, Aug 27, 2008 at 11:22 PM, Greg Wright <[email protected] <mailto: >> [email protected]>> wrote: >> >> Mahmoud Hammoud wrote: >> >> Dear all, >> I would like to create my own additional thread to do some >> things within rtspclnt.cpp. I tried to add a HXThread * data >> member m_pMyThread to the RTSPClientProtocol class and then at >> the point where I want to start the thread, I am calling >> HXThread::MakeThread(m_pMyThread) and then >> m_pMyThread->CreateThread(MyRoutine, this). This result in an >> HX_ASSERT error which eventually leads the client to crash. I >> guess I am missing something here (what please?). Should >> MyRoutine have a special structure? Can someone give me a brief >> step by step guide on how to create, start and manage a thread? >> The "Threading Model" document on the Helix Community web pages >> provides only an abstract overview, I would really appreciate >> your help. >> >> >> The best source of information is other parts of the code base the >> use threads. It would help to know what your assert is. >> >> Also, be aware that you are not free to call into the engine on >> any given thread you want, very little of it is actually thread >> safe that way. >> >> --greg. >> >> >> Best Regards, >> Mahmoud Hammoud >> >> >> >> > _______________________________________________ Helix-client-dev mailing list [email protected] http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev