Bug 31097

Summary: main thread will accept() failure when son thread and main thread accept() at the same time
Product: Base System Reporter: liang weiya <liangvy>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description liang weiya 2001-10-07 13:20:01 UTC
when main thread and son threads call accept() after bind() at the same
time , main thread's accept() will return -1 yet son threads's return 
value is ok.
(env: g++ 2.95, pthread ,all are origin installed version)
same programs tested in redhat linux 7.1 and aix4.3 , and all return 
correct value after accept().

Fix: 

this is used for thread pool server mode . don't let main() call accept() when thread pool call accept() .
How-To-Repeat: example:
void (*fun)(..) ;
main(){
 ...
 int s = socket (...) ; 
 bind(...) ;
 pthread_create(fun,...) ;
 int v = accept(s,....) ; // here will always return -1 . 
 ...
}

void* fun(s){
 ...
 int sv = accept(s,...) ;  // return ok
 ...
}
Comment 1 iedowse freebsd_committer freebsd_triage 2002-12-01 18:55:06 UTC
State Changed
From-To: open->feedback


Is this bug still present in more recent releases?
Comment 2 Kris Kennaway freebsd_committer freebsd_triage 2003-07-13 00:15:48 UTC
State Changed
From-To: feedback->closed

Feedback timeout