Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/SDL_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,13 @@ static void RefreshInterfaces(void) // WINDOWS VERSION
// AF_NETLINK covers Linux (and by extension Android). PF_ROUTE covers the BSDs (and by extension Apple platforms).
// This doesn't cover all Unix platforms that ever existed, but this hits just about everything that is still being maintained seriously.

#if defined(USE_NETLINK) || defined(PF_ROUTE)
#define USE_NETWORK_MONITOR 1
#else
#warning unknown network monitoring system for this platform - will not report network changes
#endif

#ifdef USE_NETWORK_MONITOR
static SDL_Thread *interface_change_notifications_thread = NULL;
static SDL_AtomicInt interface_change_notifications_flag; // !!! FIXME

Expand Down Expand Up @@ -559,21 +566,28 @@ static int SDLCALL LinuxInterfaceChangeNotificationThread(void *data)

return 0;
}
#endif

static bool InitInterfaceChangeNotifications(void) // LINUX/BSD VERSION
{
#ifdef USE_NETWORK_MONITOR
interface_change_notifications_thread = SDL_CreateThread(LinuxInterfaceChangeNotificationThread, "SDLNetIfaceEnum", NULL);
return (interface_change_notifications_thread != NULL);
#else
return true;
#endif
}

static void QuitInterfaceChangeNotifications(void) // LINUX/BSD VERSION
{
#ifdef USE_NETWORK_MONITOR
if (interface_change_notifications_thread) {
SDL_SetAtomicInt(&interface_change_notifications_flag, 1);
SDL_WaitThread(interface_change_notifications_thread, NULL);
SDL_SetAtomicInt(&interface_change_notifications_flag, 0);
}
interface_change_notifications_thread = NULL;
#endif
}

static void RefreshInterfaces(void) // LINUX/BSD VERSION
Expand Down
Loading