Why do you need to check thread validity anyway?  Write your program in
such a way so that you don't constantly have to second-guess your
pointers, is what I always say...

On Fri, 26 Oct 2001, Dresner, Norman A.  wrote:

>
> I can't believe that I'm the only one facing this problem.  Could we agree
> on the name of a future library routine or preprocessor macro that will be
> provided for validity checking which I could use in the near-term with my
> own code?
>
>       Norm
>
>
> > -----Original Message-----
> > From:       Victor Yodaiken [SMTP:[EMAIL PROTECTED]]
> > Sent:       Thursday, October 25, 2001 9:12 PM
> > Cc: rtlinux
> > Subject:    Re: [rtl] Follow-up:  checking a pthread-ID
> >
> > On Thu, Oct 25, 2001 at 08:56:14PM -0400, Norm Dresner wrote:
> > > While browsing the code in v3.0's rtl_sched.c &
> > > rtl_sched.h, I found that, within the RTL context, a
> > > pthread_t points to a structure of type rtl_thread_struct
> > > which contains an int-item magic and that a "valid"
> > > rtl_thread_struct will have this value equal to the
> > > constant RTL_THREAD_MAGIC.
> > >
> > > How safe is it to assume that this will always be the case
> > > and that I can implement a thread validity check with
> > >     #define    rtlTHREAD_VALID( th )
> > > ( (th)->magic ) == RTL_THREAD_MAGIC )
> > > and be safe if I -- or another programmer who takes over
> > > program maintenance from me in the unspecified future
> > > upgrades to a newer version of rtl?
> >
> > Not safe at all!  If you hide the implementation well, that's ok
> > since there should always be a way to check or at least semi-check
> > validity, but I hope to move pthread_t to something else in the next
> > year or two - it is an opaque type for a reason.
> >
> >
> >
> > >
> > >
> > >     Thanks
> > >         Norm
> > >
> > >
> > > ----- Original Message -----
> > > From: Norm Dresner <[EMAIL PROTECTED]>
> > > To: rtlinux <[EMAIL PROTECTED]>
> > > Sent: Thursday, October 25, 2001 8:42 PM
> > > Subject: checking a pthread-ID
> > >
> > >
> > > > According to the map-page, pthread_wakeup_np always
> > > returns
> > > > a zero value and consequently can't be used to determine
> > > if
> > > > the target thread in fact no longer exists.  I have two
> > > > questions:
> > > >     1. What -- if anything -- will happen if the thread
> > > has
> > > > been destroyed, i.e. either it has executed
> > > pthread_exit()
> > > > or some other process/thread has already killed it with
> > > > pthread_delete_np()?
> > > >     2. Is there any safe function to call to verify that
> > > > the target of a pthread_t still is a valid thread?
> > > >
> > > > TIA
> > > >     Norm
> > > >
> > > >
> > >
> > > -- [rtl] ---
> > > To unsubscribe:
> > > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > > --
> > > For more information on Real-Time Linux see:
> > > http://www.rtlinux.org/
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/
>

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to