I'm using winsock and calling connect
on a non-blocking socket. I occasionally see some delay (up to 200ms) before the function returns when the CPU is hogged by other processes. From what I know, a connect
on a non-blocking socket should return immediately, but perhaps connect
causes a context switch and since the CPU is working hard it takes a while before my thread gets CPU time again and exits the function.
I know (or at least fairly certain) that connect
on a blocking socket causes a context switch, but does connect
on a non-blocking socket cause one?