int globus_i_xio_win32_complete_activate(void) { globus_result_t result; globus_reltime_t period; GlobusXIOName(globus_i_xio_win32_complete_activate); GlobusXIOSystemDebugEnter(); if (!globus_i_am_only_thread()) { goto skip_activate; } GlobusLWin32PollQueueInit(); win32_mutex_init(&globus_l_xio_win32_poll_lock, 0); globus_l_xio_win32_poll_event_sleeping = GLOBUS_FALSE; globus_l_xio_win32_poll_event_pending = GLOBUS_FALSE; globus_l_xio_win32_poll_free = 0; globus_l_xio_win32_poll_event = CreateEvent(0, FALSE, FALSE, 0); if(globus_l_xio_win32_poll_event == 0) { goto error_event; } GlobusTimeReltimeSet(period, 0, 0); result = globus_callback_register_periodic( &globus_l_xio_win32_poll_handle, 0, &period, globus_l_xio_win32_poll, 0); if(result != GLOBUS_SUCCESS) { goto error_periodic; } globus_callback_add_wakeup_handler( globus_l_xio_win32_wakeup_handler, 0); skip_activate: GlobusXIOSystemDebugExit(); return GLOBUS_SUCCESS; error_periodic: CloseHandle(globus_l_xio_win32_poll_event); globus_l_xio_win32_poll_event = 0; error_event: win32_mutex_destroy(&globus_l_xio_win32_poll_lock); GlobusXIOSystemDebugExitWithError(); return GLOBUS_FAILURE; }
static globus_result_t globus_l_xio_win32_blocking_init( globus_l_xio_win32_blocking_info_t ** u_blocking_info) { globus_l_xio_win32_blocking_info_t * blocking_info; globus_result_t result; GlobusXIOName(globus_l_xio_win32_blocking_init); GlobusXIOSystemDebugEnter(); blocking_info = (globus_l_xio_win32_blocking_info_t *) globus_calloc(1, sizeof(globus_l_xio_win32_blocking_info_t)); if(!blocking_info) { result = GlobusXIOErrorMemory("blocking_info"); goto error_info; } blocking_info->event = CreateEvent(0, FALSE, FALSE, 0); if(blocking_info->event == 0) { result = GlobusXIOErrorSystemError( "CreateEvent", GetLastError()); goto error_create; } *u_blocking_info = blocking_info; GlobusXIOSystemDebugExit(); return GLOBUS_SUCCESS; error_create: globus_free(blocking_info); error_info: *u_blocking_info = 0; GlobusXIOSystemDebugExitWithError(); return result; }
int globus_i_xio_system_common_activate(void) { GlobusXIOName(globus_i_xio_system_common_activate); GlobusDebugInit(GLOBUS_XIO_SYSTEM, TRACE DATA INFO RAW); GlobusXIOSystemDebugEnter(); /* I am going to leave this memory around after deactivation. To safely * destroy them, I would need a lot more synchronization of kicked out * callbacks */ if(globus_module_activate(GLOBUS_XIO_MODULE) != GLOBUS_SUCCESS) { goto error_activate; } if(!globus_l_xio_system_memory_initialized) { globus_l_xio_system_memory_initialized = GLOBUS_TRUE; globus_memory_init( &globus_i_xio_system_op_info_memory, sizeof(globus_i_xio_system_op_info_t), 10); globus_memory_init( &globus_i_xio_system_iov_memory, sizeof(struct iovec) * 10, 10); } globus_l_xio_iov_max = -1; #ifdef _SC_IOV_MAX if (globus_l_xio_iov_max == -1) { /* If this returns -1, the limit might be indefinite if errno is * unchanged, but that doesn't mean infinite. It's unclear what * one is to do in that case */ globus_l_xio_iov_max = sysconf(_SC_IOV_MAX); } #endif #ifdef IOV_MAX if (globus_l_xio_iov_max == -1) { globus_l_xio_iov_max = IOV_MAX; } #endif #ifdef _XOPEN_IOV_MAX if (globus_l_xio_iov_max == -1) { globus_l_xio_iov_max = _XOPEN_IOV_MAX; } #endif if (globus_l_xio_iov_max == -1) { globus_l_xio_iov_max = 16; } GlobusXIOSystemDebugExit(); return GLOBUS_SUCCESS; error_activate: GlobusXIOSystemDebugExitWithError(); GlobusDebugDestroy(GLOBUS_XIO_SYSTEM); return GLOBUS_FAILURE; }