Skip to content

Commit

Permalink
Fix for compilation on Windows (lack of per-call non-blocking semantics)
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Aug 22, 2023
1 parent 81376db commit f4eff65
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Src/nwclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
// https://stackoverflow.com/a/14388707/995351
#define SO_REUSEPORT SO_REUSEADDR
#define MSG_NOSIGNAL 0
#define MSG_DONTWAIT 0
#endif

#ifdef OSX
Expand Down Expand Up @@ -252,6 +253,12 @@ static void *_listenTask( void *arg )
client->portNo = newsockfd;
client->rp = h->wp;

#ifdef WIN32
/* Set port nonblocking since it can't be done per-call in Windows */
u_long iMode=1;
ioctlsocket(newsockfd,FIONBIO,&iMode);
#endif

if ( pthread_mutex_init( &client->dataAvailable_m, NULL ) != 0 )
{
genericsExit( -1, "Failed to establish mutex for condition variable" EOL );
Expand Down

0 comments on commit f4eff65

Please sign in to comment.