To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2214
2213  |  2215
Subject: 
Re: threads
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Wed, 16 Jan 2002 19:43:14 GMT
Viewed: 
4752 times
  
two of your threads terminate shortly after being started


> int speed_target_task (int argc, char *argv[])
> {
> return 0;
> } // end of speed_target_task ()

> int right_control_task (int argc, char *argv[])
> {
> // dummy code
> int count = 0;
> 
> for (count = 255; count > 100; count--)
> {
> motor_c_speed (count);
> msleep (100);
> }
> 
> return 0;
> } // end of right_control_task ()


as far as I know, legOS provides no functionality for determining whether or
not a thread is alive or not.  You need to keep track of this yourself (e.g.
using a variable/flag that gets set when the thread dies)

Another option is to just put an infinite loop in all threads, so that they
never terminate themselves.  something like     while(1) { /* some code */
msleep(100); }

-al

"mike mcfarlane" <mcfarlane_mike@hotmail.com> wrote in message
news:Gq0uEC.99p@lugnet.com...
> Thanks Albert
> 
> > If you kill a thread, make sure it's still a valid thread (i.e. • still
> > running).  undefined behavior will result from killing an invalid thread.
> 
> How do I
> check this? There are no other tasks that can kill threads apart from this
> one. I also checked
> process IDs after creation and before killing.
> 
> 
> Best regards, mike



Message has 1 Reply:
  Re: threads
 
Albert (...) yea, I see what you are getting at. I am sure that I was hitting the bumper while the threads were still alive, but I will check again. I think this also points out some of the dangers of just dumping in some poorly thought out dummy (...) (25 years ago, 17-Jan-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: threads
 
Thanks Albert (...) still (...) How do I check this? There are no other tasks that can kill threads apart from this one. I also checked process IDs after creation and before killing. Best regards, mike (25 years ago, 16-Jan-02, to lugnet.robotics.rcx.legos)

18 Messages in This Thread:





Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR