[Ace-users] [ace-users] Why the spawned thread must be waited?
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Thu Nov 1 11:23:58 CDT 2007
Hi John,
> I am developing a windows client with MFC and ACE. For user-
>friendliness, the request to the server can be cancelled. I put two
>threads in the client, one is for UI, the other is for network
>commucation.
>
> I want to use the active object pattern to handle the net
>request:
>1. The MFC message handler received a button-click event
>2. The message handler creates an agent proxy and an
>ACE_Future_Observer object
> (exactly like %ACE_ROOT%/examples/apg/active_objects/AO2.cpp)
>3. When the request completed, the ACE_Future_Observer object would
>get the result, then notify the UI thread.
>
> Now I face a problem: if I don't call ACE_Thread_Manager::instance
>()->wait(), the spawned thread would crash; but when I call it, the UI
>thread would be blocked (and it would succeed to get the result).
>
> Why must we wait the spawned thread?
>
> When activated it, I used the flag (THR_NEW_LWP | THR_DETACHED).
It's not clear what version of ACE you are using. Perhaps you have an
old version with a bug in it? To ensure that we have proper
version/platform/compiler information, please make sure you fill out
the appropriate problem report form (PRF), which is in
$ACE_ROOT/PROBLEM-REPORT-FORM
$TAO_ROOT/PROBLEM-REPORT-FORM
or in
$ACE_ROOT/BUG-REPORT-FORM
$TAO_ROOT/BUG-REPORT-FORM
in older versions of ACE+TAO. Make sure to include this information
when asking any questions about ACE+TAO since otherwise we have to
"guess" what version/platform/compiler/options you've using, which is
very error-prone and slows down our responsiveness. If you don't use
the PRF, therefore, it is less likely that someone from the core
ACE+TAO developer team will be able to answer your question.
Naturally, we encourage and appreciate other members of the ACE+TAO
user community who can respond to questions that they have the answers
to.
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