On Thu, Mar 14, 2002, Isaac Aaron wrote about "RE: pthreads question":
> Sorry for the disclaimer, will do something about it.

It's just strange that that thing appears at the top of the message, and
the actual message appears as an additional attachment. Makes you think
your message is secondary in importance to that antivirus ad ;)

> The problem was that I didn't pthread_detach the thread, and since I didn't
> do that nor did I join the thread, pth didn't free it's resources.

Oh, you forgot also to tell us that you were using pth, not LinuxThreads
(the latter is the standard "-lpthreads" on Linux. Work is being done on
a "NGPT", a pth-based posix threads implementation, but it is not yet
complete). Anyway, the basic idea, that you should either detach or join
each thread, is true in any Posix threads implementation.

> The thing is, I Read the F Manual (over and over, even considered trying
> mit-pthreads instead), did didn't think that I WANT to detach the thread?
> (Why detach? I kind of like it... Better keep it).

That's where books are better than manuals - given their length, they can
also give examples and explain the ideas behind why certain things were
done the way they were done, and what they are good for.

The book I'd recommend is David R. Butenhof's "Programming with Posix Threads"
(see e.g., http://www.amazon.com/exec/obidos/ASIN/0201633922/thealmostcomplet )
If I remember correctly, Butenhof was one of the people working on the
Posix threads standard, and talks a lot about the motivations of how and why
to do things (it talks only on C, of course - if you're looking for OOP
abstractions of threads look elsewhere; I just wrote my own).
This is the book I learned Posix threads from.



-- 
Nadav Har'El                        |      Thursday, Mar 14 2002, 2 Nisan 5762
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |Why aren't fishmongers generous? Their
http://nadav.harel.org.il           |business makes them selfish.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to