|
Boost : |
From: Yakov Bachmutsky (yakov_at_[hidden])
Date: 2002-10-29 12:05:54
OnException() reports that the thread suffered an un-caught exception.
The user may do whatever he/she wants with this information.
The return value from this function says do we restart the thread, i.e, run
it again, or do we exit and the thread is terminated.
----- Original Message -----
From: "William E. Kempf" <wekempf_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, October 29, 2002 5:49 PM
Subject: Re: [boost] Re: new libraries proposal
>
> Yakov Bachmutsky said:
> >> Hot topic, but I don't see how this adds much utility. Maybe I'm just
> >> not fully understanding you. Care to elaborate?
> >
> > static DWORD WINAPI CThread::ThreadProc(LPVOID pv)
> > {
> > CThread *pThread = (CThread*)pv;
> > do
> > {
> > try
> > {
> > // startup
> > if( !pThread->OnStartup() )
> > break;
> > // run
> > pThread->m_dwExitCode = pThread->Run();
> > // cleanup
> > pThread->OnCleanup();
> > break;
> > }
> > catch(...)
> > {
> > }
> > if( !pThread->OnException() )
> > /*****************************************/
> > {
> > pThread->OnCleanup();
> > break;
> > }
> > }
> > while(true);
> > return pThread->m_dwExitCode;
> > }
> > // this function can be overriden to support other styles like class
> > member functions.
> > DWORD CThread::Run()
> > {
> > return (m_pHandler) (m_pParams);
> > }
>
> I still don't follow what this is supposed to do. Can you post a short
> but complete example? Specifically, I can't tell if OnException() just
> reports whether or not the thread was terminated by an uncaught exception,
> or if it does something entirely different.
>
> > The only thing I haven't mention yet, and I guess its no much interest
> > as well, is that my threads have names(std::string)
> > I'm just a fun of neat logs and so my thread class also logs that it
> > started, ended and so on with its name inside.
>
> This is actually something that may well be added to Boost.Threads, via
> the upcoming "thread properties" (which will including things like thread
> priority).
>
> --
> William E. Kempf
>
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk