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 / 2227
2226  |  2228
Subject: 
Re: More on threads
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 19 Jan 2002 15:59:09 GMT
Viewed: 
2141 times
  
Of course you are right. I think it is a bad programming style not to give
your program the
ability to terminate but to run in an endless loop. But

This is not true of an embedded system
though which will have to run 'forever'.

This is, because the work_task thread has a • priority of NORMAL+4. So, the
main task won't get
any time slice at all.

NO time slice or
just a very small chunk of time?

Also, what priority does this mean main() has? One of the
other suggestions that was given was to just call one of my threads from
main() and let it run as an
infinite loop, ie, it will never return to main(), so main() can never exit.
This would not work if
main() has a very low priority or even no time slice at all??

Can anyone recommend any good
books or websites on the subjects that have been touched on this thread
(sic), ie, memory
management, threads etc.

Best regards, mike



Message has 1 Reply:
  Re: More on threads
 
(...) Digging through tm.c gave me the impression, that main will indeed get no time slice. So I wrote another test program: ---...--- #include <conio.h> #include <unistd.h> pid_t worker; int work_task(int argc, char *argv[]); int main() { int i; i (...) (23 years ago, 19-Jan-02, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  More on threads
 
(...) Of course you are right. I think it is a bad programming style not to give your program the ability to terminate but to run in an endless loop. But what is the penalty for this bad style? I've done some investigations and here are the results: (...) (23 years ago, 18-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
    

Custom Search

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