src/port.c
os_pipe_t os_server_pipe_accept_client(os_pipe_t server){
	OVERLAPPED ol;
	DWORD undef;
	HANDLE handles[2];
	memset(&ol,0,sizeof(ol));
	ol.hEvent=CreateEvent(NULL,TRUE,FALSE,NULL);
	ConnectNamedPipe(server,&ol);
	handles[0]=ol.hEvent;
	handles[1]=event;
	WaitForMultipleObjects(2,handles,FALSE,INFINITE);
	if (GetOverlappedResult(server,&ol,&undef,FALSE)){
		CloseHandle(ol.hEvent);
		return server;
	}
	CloseHandle(ol.hEvent);
	return INVALID_HANDLE_VALUE;
}
/*this function is a bit complex because we need to wakeup someday
even if nobody connects to the pipe.
os_server_pipe_close() makes this function to exit.
*/
this function is a bit complex because we need to wakeup someday
even if nobody connects to the pipe.
os_server_pipe_close() makes this function to exit.
this function is a bit complex because we need to wakeup someday even if nobody connects to the pipe . os_server_pipe_close () makes this function to exit .
os_pipe_t os_server_pipe_accept_client(os_pipe_t server){
	OVERLAPPED ol;
	DWORD undef;
	HANDLE handles[2];
	memset(&ol,0,sizeof(ol));
	ol.hEvent=CreateEvent(NULL,TRUE,FALSE,NULL);
	ConnectNamedPipe(server,&ol);
	handles[0]=ol.hEvent;
	handles[1]=event;
	WaitForMultipleObjects(2,handles,FALSE,INFINITE);
	if (GetOverlappedResult(server,&ol,&undef,FALSE)){
		CloseHandle(ol.hEvent);
		return server;
	}
	CloseHandle(ol.hEvent);
	return INVALID_HANDLE_VALUE;
}
os_pipe_t os_server_pipe_accept_client ( os_pipe_t server ) { OVERLAPPED ol ; DWORD undef ; HANDLE handles [ 2 ] ; memset ( & ol , 0 , sizeof ( ol ) ) ; ol . hEvent = CreateEvent ( NULL , TRUE , FALSE , NULL ) ; ConnectNamedPipe ( server , & ol ) ; handles [ 0 ] = ol . hEvent ; handles [ 1 ] = event ; WaitForMultipleObjects ( 2 , handles , FALSE , INFINITE ) ; if ( GetOverlappedResult ( server , & ol , & undef , FALSE ) ) { CloseHandle ( ol . hEvent ) ; return server ; } CloseHandle ( ol . hEvent ) ; return INVALID_HANDLE_VALUE ; }
this function is a bit complex because we need to wakeup someday
even if nobody connects to the pipe.
this function is a bit complex because we need to wakeup someday even if nobody connects to the pipe .