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 / 3604
3603  |  3605
Subject: 
Re: The BrickOS Task Manager
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 5 Jan 2004 00:54:02 GMT
Viewed: 
3861 times
  
In lugnet.robotics.rcx.legos, Bapt Denaeyer wrote:
pid_t my_thread;
Hmm... it doesn't seem to recognize pid_t as a valid type. I have a document of
the functions in brickOS that indicates execi returning an int. Which is it?

I think that's all you need to know ;-)
Still confused... I'll post the poignant code:

pid_t rowthread;
pid_t colthread;

void gotocolumn(short column)
{
  coldone = false;
  ...
  coldone = true;
}

void gotorow(short row)
{
  rowdone = false;
  ...
  rowdone = true;
}

void gotorowcolumn(short row, short column)
{
  rowthread = execi(&gotorow, row, PRIO_NORMAL - 1, DEFAULT_STACK_SIZE);
  colthread = execi(&gotocolumn, column, PRIO_NORMAL - 2, DEFAULT_STACK_SIZE);
  while !(rowdone && coldone);
}

This isn't the exact example I gave above, but it's something I thought I'd try
as an experiment. The idea was that the two tasks would initialize and
independently move two axis of a grid scanner... once they were both complete,
the two global flags would register with the initial procedure. I included tm.c,
but as I said, it's not registering pid_t as a type. And changing it to int
gives a whole slew of type errors on the execi lines. ??

Thanks again,
Mike



Message has 3 Replies:
  Re: The BrickOS Task Manager
 
(...) [snip] (...) Hi Mike, What version of BrickOS are you using? IIRC the correct type for thread IDs in the current version is tid_t, not pid_t. Also, I dunno if it was a typo, but you should include tm.h, not tm.c. HTH ROSCO (21 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)
  Re: The BrickOS Task Manager
 
in version 2.6.1 (I've just download it) extern tid_t execi(int (*code_start) (int, char **), int argc, char **argv, priority_t priority, size_t stack_size); declare in unistd.h ! So use the tid_t and not the pid_t ! (like say ROSCO) Does anyone (...) (21 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)
  Re: The BrickOS Task Manager
 
(...) only as a side note: you shouldn't really do this. you are burning precious cpu-cycles here. it should look something like while(!(rowdone && coldone)) msleep(5); if you're in a hurry you can make smaller msleep's... (21 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: The BrickOS Task Manager
 
(...) To make a thread with BrickOS (I use the 0.2.4, but I think that the method is the same !) You need to use the execi function : pid_t my_thread; ... (function other declaration int funct(int argc, char *argv[]) { // Function that the robot (...) (21 years ago, 4-Jan-04, to lugnet.robotics.rcx.legos)

15 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
    

Custom Search

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