Pthreads tutorial

It seems quite a few people are interested in said pthreads tutorial. I
didn’t dare to post the .ps.gz (HUGE!), but now that I’ve converted the
text to ASCII the tutorial is only 8K. I’ve attached the .txt.gz. Enjoy
:wink:
-------------- next part --------------
A non-text attachment was scrubbed…
Name: pthreads.txt.gz
Type: application/x-gzip
Size: 7788 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/19990801/248249ec/attachment.bin

It seems quite a few people are interested in said pthreads tutorial. I
didn’t dare to post the .ps.gz (HUGE!), but now that I’ve converted the
text to ASCII the tutorial is only 8K. I’ve attached the .txt.gz. Enjoy
:wink:

A while back I found a PDF (sorry, no other formats) file called “An
Introduction to Programming with Threads” by Andrew D. Birrell, who works
(or worked) for the ‘digital’ Systems Research Center. It’s a good paper
and I thought some of you might like to read it. I don’t know where I got
it from so I have put it up for download.

http://www.victoria.tc.ca/~uf657/threads.zipOn Sun, 1 Aug 1999, Daniel Heck wrote:

ARRRGGHHHH!!! I was trying to use the demo for PThreads that was posted
the other day. pthread_attr_default doesn’t seem to exist. What am I
doing wrong here? Sorry it’s off topic but this is the only group of
people whom I feel would have a good grasp of how to use this library.

Thanks
Dave

Yeah. That’s the one major problem I had wit the tutorial is that it
shows that pthread_attr_default which doesn’t exist in Linux pthreads.
However, after scanning through the SDL source code, I found out that
if you use NULL instead, it works.

But as long as I’m off topic, can someone tell me if I’m being stupid
in thinking that you can fopen() a file in a thread. I’ve tried doing
some tests and whenever I call fopen(), it returns NULL. Using open()
gets me no farther either.

-KWOn 4 Aug, Leimy wrote:

ARRRGGHHHH!!! I was trying to use the demo for PThreads that was posted
the other day. pthread_attr_default doesn’t seem to exist. What am I
doing wrong here? Sorry it’s off topic but this is the only group of
people whom I feel would have a good grasp of how to use this library.

Hi there…

kwalker at aros.net wrote:

ARRRGGHHHH!!! I was trying to use the demo for PThreads that was posted
the other day. pthread_attr_default doesn’t seem to exist. What am I
doing wrong here? Sorry it’s off topic but this is the only group of
people whom I feel would have a good grasp of how to use this library.

Yeah. That’s the one major problem I had wit the tutorial is that it
shows that pthread_attr_default which doesn’t exist in Linux pthreads.
However, after scanning through the SDL source code, I found out that
if you use NULL instead, it works.

But as long as I’m off topic, can someone tell me if I’m being stupid
in thinking that you can fopen() a file in a thread. I’ve tried doing
some tests and whenever I call fopen(), it returns NULL. Using open()
gets me no farther either.

Are you compiling your code with -D_REENTRANT? What libc version are you using?

:slight_smile:
Peter> On 4 Aug, Leimy wrote:

-KW

Peter Hawkins
Internet Solutions Australia
peterh at isa.net.au

Heh. Sometimes I wish I’d been that stupid. :slight_smile: Yes, I defined
-D_REENTRANT on the gcc command line, and I’m building this on a box based
on RedHat 5.2. The glibc version says 2.0.7-29.

-KW> On Aug 5, Peter wrote:

Are you compiling your code with -D_REENTRANT? What libc version are you
using?

Who’s question were you trying to answer?
I am not compiling with any -D’s

DaveOn Thu, 5 Aug 1999, Peter wrote:

Hi there…

kwalker at aros.net wrote:

On 4 Aug, Leimy wrote:

ARRRGGHHHH!!! I was trying to use the demo for PThreads that was posted
the other day. pthread_attr_default doesn’t seem to exist. What am I
doing wrong here? Sorry it’s off topic but this is the only group of
people whom I feel would have a good grasp of how to use this library.

Yeah. That’s the one major problem I had wit the tutorial is that it
shows that pthread_attr_default which doesn’t exist in Linux pthreads.
However, after scanning through the SDL source code, I found out that
if you use NULL instead, it works.

But as long as I’m off topic, can someone tell me if I’m being stupid
in thinking that you can fopen() a file in a thread. I’ve tried doing
some tests and whenever I call fopen(), it returns NULL. Using open()
gets me no farther either.

Are you compiling your code with -D_REENTRANT? What libc version are you using?

:slight_smile:
Peter

-KW

Peter Hawkins
Internet Solutions Australia
peterh at isa.net.au