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 / 3624
3623  |  3625
Subject: 
Re: The BrickOS Task Manager
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 10 Jan 2004 14:54:43 GMT
Viewed: 
7355 times
  
In lugnet.robotics.rcx.legos, Michael Purvis wrote:
> In lugnet.robotics.rcx.legos, Joseph Woolley wrote:
> > IIRC the issue was that Task, Process and Thread were all used to
> > represent the same item/concept in the Kernel code.
> > 
> > After some discussion, it was decided that the word Task would be used
> > in all cases.  This improves readability, etc... (ie. Task Manager)
> 
> Sorry, I'm still just not getting it at all. I have type errors all over the
> place trying to pass arguments to my task. Could someone please simply email me
> or post an example of a program that starts, runs two or more threads, and will
> actually compile?


This works.

Steve

----
#include <unistd.h>
#include <dbutton.h>
#include <dmotor.h>

int MotorSpeed = 0;

int RunMotor()
{
while (!shutdown_requested())
{
motor_a_dir(MotorSpeed);
}
  return 0;
}

int CheckButton()
{
while (!shutdown_requested())
{
if (PRESSED(dbutton(),BUTTON_PROGRAM)) MotorSpeed = 1;
else MotorSpeed = 0;
}
  return 0;
}


int main()
{

execi(&CheckButton, 0, NULL, 1, DEFAULT_STACK_SIZE);
execi(&RunMotor, 0, NULL, 1, DEFAULT_STACK_SIZE);

while(!shutdown_requested())
msleep(1000);

return 0;

}
------



Message has 2 Replies:
  Re: The BrickOS Task Manager
 
(...) Thank you very much. That was exactly what I needed. Very much appreciated. Mike (23 years ago, 10-Jan-04, to lugnet.robotics.rcx.legos)
  Re: The BrickOS Task Manager
 
(...) Thank you again for the help, but unfortunately it only compiles when saved as a '.c' file. Some of my code depends pretty heavily on classes... is there any easy change to make this work as object oriented code? *just spent two hours trying (...) (23 years ago, 12-Jan-04, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: The BrickOS Task Manager
 
(...) Sorry, I'm still just not getting it at all. I have type errors all over the place trying to pass arguments to my task. Could someone please simply email me or post an example of a program that starts, runs two or more threads, and will (...) (23 years ago, 10-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
    

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