select call freeze

Kirill Mukhoyarov admin at btobits.com
Tue Nov 16 09:50:32 PST 2004


Hi all !

Problem introduction:

1) FreeBSD 4.10-Stable
1) 2 file descriptors obtained from pipe() call [fd1,fd2]
2) 2 threads

Problem description:

One thread is receiver, after starting it do some user level tasks and
call select with fds operate with fd1.

fd_set fds;

FD_ZERO(&fds);
FD_SET(fd1, &fds);

select(FD_SETSIZE,&fds,NULL,NULL,NULL);

Another thread is sender, it do some user level operations, after that
call write with fd2 as argument.

write(fd2,(char*)buf,bufLen);

Select from first thread did not return control at all. If process
receive SIGINT - select unfreeze. Signal handlers are not redefined.

P.S. This problem found in shbuftest program - part of
ports/devel/libshbuf-0.0.2_1 port.

_____________________________________________________________
Kirill I. Mukhoyarov                                                            
B2B ITS Corp.           +380 44 4173322                                         
http://b2bits.com
admin+AT+btobits.com



More information about the freebsd-questions mailing list