| 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: | misc | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->feedback Is this bug still present in more recent releases? State Changed From-To: feedback->closed Feedback timeout |
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 ... }