[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

999.0. "Query: Can a thread mark itself for deletion?" by COOKIE::KITTELL (Richard - Architected Info Mgmt) Thu May 09 1991 20:16

All the SRM descriptions for mcc_thread_delete say "when a thread has been
terminated and has been marked for delete, then the thread is deleted".

That implies that the thread has to have terminated before it can be
marked for delete. True?

What I'd like to do is run a thread once, and have it deleted when it
terminates. Can I have it mark itself for delete?

I've tried it and it works, but I just want to be sure I'm not trashing
some thread structures somewhere.
T.RTitleUserPersonal
Name
DateLines
999.1Yes, it is just marked for delete, nothing gets trashedTOOK::GUERTINI do this for a living -- reallyFri May 10 1991 12:496
    I usually do something like:
    
    stat = mcc_thread_create( ..., &child_thr_id, ...);
    mcc_thread_delete( &child_thr_id );
    
    -Matt.
999.2COOKIE::KITTELLRichard - Architected Info MgmtFri May 10 1991 14:0912
RE: .1

Thanks, Matt.

So, just to be sure I understand the strategy, the only time I wouldn't
want to mark a thread for delete as soon as I create it is when I'll
want to come along after it terminates and get its attributes. Such as
its completion status. And then once I've got everything I want I do the
delete.

Right?
999.3That should work, but along the same lines...TOOK::GUERTINI do this for a living -- reallyFri May 10 1991 16:3424
    I believe that would work.  But, going on two year old knowledge, there
    is also the case of doing a join with a child thread...
    
            stat = mcc_thread_create( Junior, ... &Juniors_thrid, ...);
            mcc_thread_delete( &Juniors_thrid);
                       :
                   some work
                       :
            stat = mcc_thread_join_all( Juniors_thrid_vec );
    
    Notice that if thread "Junior" exits *before* the join statement that
    all knowledge of Junior will be deleted, and the join will fail with
    "Thread existence error".  But if we did it this way...
    
            stat = mcc_thread_create( Junior, ... &Juniors_thrid, ...);
                    :
                some work
                    :
            stat = mcc_thread_join_all( Juniors_thrid_vec );
            mcc_thread_delete( &Juniors_thrid );
    
    The join should always work, even if Junior exits before the join.
    
    -Matt.