[ace-users] Possible bug in ACE_Task_Base::cleanup.

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Thu Jul 12 03:27:31 CDT 2007


Hi Dmitry,

>Thanks for irrefragable answer :)
>Ok, I will carefully read both of your books.
>
>Sorry for my question if it was so stupid.
>I'm newbie in programming with ACE.
>
>Yes, I agree that the cause of seg fault in _this_ test program
>lies in that main thread exits while there is at least one active Job
>thread.
>It was my oversight while writing test program.
>
>What if a add the following line
>ACE_OS::sleep(60 * 60 * 24); // HACK
>before return operator in main() function?
>
>In such a case main thread sleeps for a day.
>It's a hack of course :)

I recommend you read chapter 9 of C++NPv1
<www.cs.wustl.edu/~schmidt/ACE/book1/> and see how to use
ACE_Thread_Manager::wait() rather than the sleep hack.

>However, SIGSEGV signal may be generated if object
>of class Job has been deleted in the main thread
>after decrementing threads count, but before
>calling close() hook in cleanup() method of Job thread.
>So, close() method will be called on previously deleted
>object!
>Am I wrong?

You need to ensure that this doesn't happen, as per the discussions in
Chapter 6 in C++NPv2 <www.cs.wustl.edu/~schmidt/ACE/book2>.

Thanks,

        Doug
-- 
Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu



More information about the Ace-users mailing list