STABLE14-windows-library-cleanup-20060702

afs_winsockCleanup


(cherry picked from commit 20b4f785b56ff604bab72d3b624aae74a9e5ae5d)
This commit is contained in:
Jeffrey Altman 2006-07-03 02:16:35 +00:00
parent 3514aec55d
commit 1e0e5254cb
6 changed files with 24 additions and 3 deletions

View File

@ -84,3 +84,5 @@ EXPORTS
DISK_function_names @83 DATA DISK_function_names @83 DATA
VOTE_function_names @84 DATA VOTE_function_names @84 DATA
rx_Finalize @85
pr_End @86

View File

@ -2021,6 +2021,10 @@ rx_Finalize(void)
} }
rxi_flushtrace(); rxi_flushtrace();
#ifdef AFS_NT40_ENV
afs_winsockCleanup();
#endif
rxinit_status = 1; rxinit_status = 1;
UNLOCK_RX_INIT; UNLOCK_RX_INIT;
} }

View File

@ -87,7 +87,9 @@ rxi_Delay(int sec)
void void
rxi_InitializeThreadSupport(void) rxi_InitializeThreadSupport(void)
{ {
listeners_started = 0; /* listeners_started must only be reset if
* the listener thread terminates */
/* listeners_started = 0; */
clock_GetTime(&rxi_clockNow); clock_GetTime(&rxi_clockNow);
} }
@ -322,6 +324,9 @@ rxi_StartListener(void)
pthread_attr_t tattr; pthread_attr_t tattr;
AFS_SIGSET_DECL; AFS_SIGSET_DECL;
if (listeners_started)
return;
if (pthread_attr_init(&tattr) != 0) { if (pthread_attr_init(&tattr) != 0) {
dpf dpf
(("Unable to create Rx event handling thread (pthread_attr_init)\n")); (("Unable to create Rx event handling thread (pthread_attr_init)\n"));

View File

@ -84,3 +84,5 @@ EXPORTS
DISK_function_names @83 DATA DISK_function_names @83 DATA
VOTE_function_names @84 DATA VOTE_function_names @84 DATA
rx_Finalize @85
pr_End @86

View File

@ -90,6 +90,7 @@ afs_vsnprintf( /*@out@ */ char *p, size_t avail, const char *fmt,
/* Initialize the windows sockets before calling networking routines. */ /* Initialize the windows sockets before calling networking routines. */
extern int afs_winsockInit(void); extern int afs_winsockInit(void);
extern void afs_winsockCleanup(void);
struct timezone { struct timezone {
int tz_minuteswest; /* of Greenwich */ int tz_minuteswest; /* of Greenwich */

View File

@ -25,11 +25,11 @@ RCSID
* *
* Returns 0 on success, -1 on error. * Returns 0 on success, -1 on error.
*/ */
static int once = 1;
int int
afs_winsockInit(void) afs_winsockInit(void)
{ {
static int once = 1;
if (once) { if (once) {
int code; int code;
WSADATA data; WSADATA data;
@ -48,6 +48,13 @@ afs_winsockInit(void)
return 0; return 0;
} }
void
afs_winsockCleanup(void)
{
WSACleanup();
once = 0;
}
int int
afs_gettimeofday(struct timeval *tv, struct timezone *tz) afs_gettimeofday(struct timeval *tv, struct timezone *tz)
{ {