On 06/25/2012 12:45 AM, Yunkai Zhang wrote: > I suggests that we can put fd into sockfd_cache when the cached fd have > been used by other thread, so that next call of sheep_get_fd() need not > to execute connect_to() again. I am not sure if I understand your question, but sheep_get_fd() will NOT call connect_to() for free cached FDs. Only if all the cached FDs of one node are all used by other threads, it temporarily create a new connection that will be closed by subsequent sheep_put_fd(). This design prevent FD from being concurrent accessed by more than one threads at a time. Thanks, Yuan |