Pthreads and Pointers

Pthreads and Pointers

Post by Amalga » Sat, 02 Jan 1999 04:00:00

I recently tried rewriting a simple irc proxy server I had coded
previously to one that used threads. I pass a pointer to a structure
containing two socket descriptors (client and server) to a thread that
relays messages from the client and then to another thread that relays
messages form the server. The proxy server seg faults, however.  I can
see no reason for it, it reads from the server and then segfaults before
main() can call the second thread.

I'm currently running Linux 2.0.36 and do not have access to another
platform at the moment. Since Linux kernel 2.0.* emulates threads using
fork() and shared memory(?), I thought perhaps the emulation was
conflicting with my (normally acceptable) use of pointers.

Complete source can be found at

I would appreciate it if someone is able to successfully run or identify
a bug in the code to contact me. Thanks.