thread should have endless while loop ??

Hello.

I am coding some real-time program for learning QNX. I will receive data
from serial port periodically , generate time interrupt internally (faster
than serial port data reception), and perform some computations. I will make
threads as many as possible.
Here is the question.

Some thread will respond to time interrupt or to data receptions, : then
should these threads have while (FOREVER) loop to survive until program
terminates ??

Other threads will respond to the other thread. : then I believe this thread
may not have endless while loop. in this case, is this thread (created and
terminated), and (created and terminated) as program is going ?? :slight_smile:

Thanks!

Pasus

“Pasus” <pasus@mail.nu> wrote in message news:9sckb9$hiq$1@inn.qnx.com

Hello.

I am coding some real-time program for learning QNX. I will receive data
from serial port periodically , generate time interrupt internally (faster
than serial port data reception), and perform some computations. I will
make
threads as many as possible.

timer interrupt are typicaly 1ms, hence if you faster then 9600 you will
need
to setup a special timer interrupt.

Here is the question.

Some thread will respond to time interrupt or to data receptions, : then
should these threads have while (FOREVER) loop to survive until program
terminates ??

In general that’s what all program/thread should do.

for(;:wink: {
wait_event();
handle_event();
}


d
Other threads will respond to the other thread. : then I believe this
thread
may not have endless while loop. in this case, is this thread (created and
terminated), and (created and terminated) as program is going ?? > :slight_smile:

I’m have a hard time understanding your description. Starting and killing
thread should be avoided when possible. It’s better to start the threads
when the program starts, then have these threads wait for something to do.
Of course it you have one event every hour creating/destroyting a thread
everytime isn’t a big issue, but it you have 100 events a seconds it just
had overhead.


Thanks!

Pasus

“Pasus” <> pasus@mail.nu> > wrote in message news:9sckb9$hiq$> 1@inn.qnx.com> …
Hello.

I am coding some real-time program for learning QNX. I will receive data
from serial port periodically , generate time interrupt internally
(faster
than serial port data reception), and perform some computations. I will
make
threads as many as possible.

timer interrupt are typicaly 1ms, hence if you faster then 9600 you will
need
to setup a special timer interrupt.

Here is the question.

Some thread will respond to time interrupt or to data receptions, : then
should these threads have while (FOREVER) loop to survive until program
terminates ??

In general that’s what all program/thread should do.

for(;:wink: {
wait_event();
handle_event();
}


d
Other threads will respond to the other thread. : then I believe this
thread
may not have endless while loop. in this case, is this thread (created
and
terminated), and (created and terminated) as program is going ?? > :slight_smile:


I’m have a hard time understanding your description. Starting and killing
thread should be avoided when possible. It’s better to start the
threads
when the program starts, then have these threads wait for something to do.
Of course it you have one event every hour creating/destroyting a thread
everytime isn’t a big issue, but it you have 100 events a seconds it just
had overhead.


Thanks!

Pasus
\