[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fPIC + pthreads + NB connect => trouble?

From: Florin Malita
Subject: fPIC + pthreads + NB connect => trouble?
Date: 22 Jan 2003 02:40:37 +0200

Hope this is the right place to spill this, it gave me headaches for 2
days now :(

I'm writing a library which creates a working thread doing non-blocking
I/O. Everything looks & works OK till I try to compile the crap with
-fPIC (it will eventually end up being a shared lib). Then, the
previously nice working non-blocking connect calls start getting
blocking :( No longer do I get the EINPROGRESS errno with immediate
return. Gdb shows the thread blocking on libc's connect, even though the
socket is verified to have O_NONBLOCK set.

I've been trying all kinds of tricks to circumvent this issues but to no
success. I've even isolated the problem to a 3 functions source file: if
I compile it without -fPIC everything works fine, if I use -fPIC it just

One interesting issue: it looks like the connects don't get blocking
right from the start but after a number of calls (the thread initiates
quite a few connections).

Has anyone ever seen this kind of weird behavior? What could I be doing
that would cause it? Could it be a compiler/glibc bug?

Any ideas/help will be appreciated.

Florin Malita      web:        http://www.malinux.net
                   public key: http://www.malinux.net/data/fmalita.gpg

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]