/* Specification. */
#include "sockets.h"
-/* The attribute __const__ was added in gcc 2.95. */
-#undef _GL_ATTRIBUTE_CONST
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
-#else
-# define _GL_ATTRIBUTE_CONST /* empty */
-#endif
-
#if WINDOWS_SOCKETS
/* This includes winsock2.h on MinGW. */
# include <sys/socket.h>
# include "fd-hook.h"
+# include "msvc-nothrow.h"
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
# include "w32sock.h"
gl_close_fn primary,
int fd)
{
+ /* Note about multithread-safety: There is a race condition where, between
+ our calls to closesocket() and the primary close(), some other thread
+ could make system calls that allocate precisely the same HANDLE value
+ as sock; then the primary close() would call CloseHandle() on it. */
SOCKET sock;
WSANETWORKEVENTS ev;
#endif /* WINDOWS_SOCKETS */
-int _GL_ATTRIBUTE_CONST
+int
gl_sockets_startup (int version _GL_UNUSED)
{
#if WINDOWS_SOCKETS