struct server_context
{
CRITICAL_SECTION cs;
int running;
};主线程:
...
struct server_context *sc = (struct server_context *)param;while(sc->running)
{
//accept connection and handle.
}
...工作线程:
...
struct server_context *sc = (struct server_context *)param;EnterCriticalSection(&sc->cs);
sc->running = 0;
LeaveCriticalSection(&sc->cs);
...运行工作线程后,主线程并没有因为sc->runnning = 0而退出循环,请教各位大侠,是何缘由。