copy to the list... On Sun, May 22, 2016 at 3:31 AM, Gert Doering <g...@greenie.muc.de> wrote:
> Hi, > > On Sun, May 22, 2016 at 12:46:27AM -0400, Selva Nair wrote: > > { > > size += 10; > > - handles = realloc (handles, size * sizeof (HANDLE)); > > - if (handles == NULL) > > - return ERROR_OUTOFMEMORY; > > + LPHANDLE tmp = realloc (handles, size * sizeof (HANDLE)); > > + if (tmp == NULL) > > ... oh, and this might actually fail MSVC compilation, due to > "variable declared after other code parts" (size += 10)... > Isn't it time to deprecate support for visual studio older than 2013? MSVC in VS-2015 supports C99 constructs and VS2013 may also do. If not, I'll submit a version 2. > > > if (error) > > { > > + ReturnError (pipe, error, L"Insufficient reources to > service new clients", 1, &exit_event); > > + /* Update wait handles again after removing the last > worker thread */ > > + RemoveListItem (&threads, CmpHandle, thread); > > + UpdateWaitHandles (&handles, &handle_count, io_event, > exit_event, threads); > > TerminateThread (thread, 1); > > CloseHandleEx (&thread); > > CloseHandleEx (&pipe); > > - SetEvent (exit_event); > > So we do not exit anymore when this fails, except if WAIT_FAILED? > That is correct. I tested it and works nicely -- i.e., on realloc error, all previous connections continue while new connections get an error message. Selva