Subject:
|
LegOS 0.2.0a multi-threading problem
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Mon, 25 Oct 1999 16:23:47 GMT
|
Viewed:
|
880 times
|
| |
| |
I have been attempting to us the thread API for a LegOS project. I have been
following the examples I found on the LegOS How-To page with out much success.
If I run some simple code inside the main function it works fine but if I try
the same code inside a thread and call it with execi() the RCX locks up.
Here is the code (with the thread model):
// I expect this code to start the motors forward for two seconds and then exit
// Instead when the code it executed the RCX stops responding and need a
// battery removed to clear its memory.
#include "conio.h"
#include "unistd.h"
#include "dkey.h"
#include "dsensor.h"
#include "dmotor.h"
#include "sys/tm.h"
#include "rom/system.h"
pid_t t1;
int rover (int argc,char **argv) {
motor_a_speed(MAX_SPEED);
motor_c_speed(MAX_SPEED);
motor_a_dir(fwd);
motor_c_dir(fwd);
cputs("fwwd ");
sleep(2);
motor_a_speed(off);
motor_c_speed(off);
return 0;
}
int main()
{
t1=execi(&rover,0,NULL,1,DEFAULT_STACK_SIZE);
tm_start(); /* starts t1 */
return 0;
}
|
|
Message has 1 Reply:
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|