Hi,

I am experiencing certain difficulties using pthread in a C++ program 
under SunOs. I wrote a server application in which I start a pthread 
which I call reader that blocks trying to read data from a datagram 
socket ( using recvfrom( ) ). In the meantime the main thread does some 
useful work. The idea is that if input arrives it is read by the reader 
thread and serviced appropriately and the main thread is actually never 
blocked.

The problem though is that when I start my application the reader thread 
is started and everything is executed up to the point at which I call the 
blocking recvfrom function and then I get a Segmentation fault, instead 
of just blocking the reader thread.

What is really strange is that if I exchange the recvfrom function with a 
different blocking statement say: cin >> dummy; everything proceeds as it 
should: the reader blocks ( until I press the enter key ), and the main 
thread keeps on working.

Is there some kind of incompatibility between network functins like 
recvfrom and pthreads. 

Any kind of help would be appreciated.

Thanx
mich

Reply via email to