On Wed, Mar 11, 2020 at 3:14 PM Stanislav Fomichev <sdf@xxxxxxxxxxx> wrote: > > On 03/11, Andrii Nakryiko wrote: > > On Wed, Mar 11, 2020 at 1:41 PM Stanislav Fomichev <sdf@xxxxxxxxxxx> wrote: > > > > > > On 03/11, Andrii Nakryiko wrote: > > > [..] > > > > + pthread_join(tid, &server_res); > > > > + CHECK_FAIL(IS_ERR(server_res)); > > > > > > I wonder if we add (move) close(server_fd) before pthread_join(), can we > > > fix this issue without using non-blocking socket? The accept() should > > > return as soon as server_fd is closed so it's essentially your > > > 'server_done'. > > > > That was my first attempt. Amazingly, closing listening socket FD > > doesn't unblock accept()... > Ugh :-( > > In this case, feel free to slap: > Reviewed-by: Stanislav Fomichev <sdf@xxxxxxxxxx> > > My only other (minor) suggestion was to add a small delay in the first > loop: > > while (!server_done) { > accept() > if (!err) { > udelay(50) <-- > continue > } > } > > But I suppose that shouldn't be that big of a deal.. It's actually bad, I'll fix it. Not sure how I missed that one... Thanks!