[Tutor] threading vs. forking?
Thomas CLive Richards
thomi@thomi.imail.net.nz
Thu Jul 10 21:02:01 2003
> Your worker thread would then alternate between checking if there's
> data to read on the serial port, and checking if there's anything in
> the Queue that it should send on the serial port. Note that a worker
> thread cannot be killed from the main thread -- if you want a worker
> thread to end before the entire program shuts down, that thread needs
> to end on its own, so you may want to have some way to ask that thread
> to commit suicide. This could be a matter of sending a special token
> in the output-queue, if you have one, or it could be an independent
> threading signal.
>
with "main" and "child" threads, am i correct when i say that if you
only have two threads (a min and a child thread), you only actually need
to create the child thread, and the main thread is just run as the rest
of the program? (kind of like how it's done with forking)?
or do you need to create two threads....hmmm..
/me is confused
--
Thomi Richards,
thomi@thomi.imail.net.nz