Cygwin: fhandler_fifo::delete_client_handler: improve efficiency
Delete a client handler by swapping it with the last one in the list instead of calling memmove.
This commit is contained in:
parent
573dda0cf2
commit
49a9ffdf4b
@ -377,14 +377,14 @@ fhandler_fifo::add_client_handler (bool new_pipe_instance)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always called with fifo_client_lock in place. */
|
/* Always called with fifo_client_lock in place. Delete a
|
||||||
|
client_handler by swapping it with the last one in the list. */
|
||||||
void
|
void
|
||||||
fhandler_fifo::delete_client_handler (int i)
|
fhandler_fifo::delete_client_handler (int i)
|
||||||
{
|
{
|
||||||
fc_handler[i].close ();
|
fc_handler[i].close ();
|
||||||
if (i < --nhandlers)
|
if (i < --nhandlers)
|
||||||
memmove (fc_handler + i, fc_handler + i + 1,
|
fc_handler[i] = fc_handler[nhandlers];
|
||||||
(nhandlers - i) * sizeof (fc_handler[i]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete handlers that we will never read from. Always called with
|
/* Delete handlers that we will never read from. Always called with
|
||||||
|
Loading…
Reference in New Issue
Block a user