This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fPIC + pthreads + NB connect => trouble?


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
chokes.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]