-
-void _wapi_handle_update_refs (void)
-{
- guint32 i, k;
- int thr_ret;
- guint32 now = (guint32)(time (NULL) & 0xFFFFFFFF);
-
- thr_ret = _wapi_handle_lock_shared_handles ();
- g_assert (thr_ret == 0);
-
- /* Prevent file share entries racing with us */
- thr_ret = _wapi_shm_sem_lock (_WAPI_SHARED_SEM_FILESHARE);
- g_assert(thr_ret == 0);
-
- thr_ret = mono_os_mutex_lock (&scan_mutex);
-
- for(i = SLOT_INDEX (0); i < _wapi_private_handle_slot_count; i++) {
- if (_wapi_private_handles [i]) {
- for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
- struct _WapiHandleUnshared *handle = &_wapi_private_handles [i][k];
-
- if (_WAPI_SHARED_HANDLE(handle->type)) {
- struct _WapiHandleShared *shared_data;
-
- DEBUG ("%s: (%d) handle 0x%x is SHARED (%s)", __func__, _wapi_getpid (), i * _WAPI_HANDLE_INITIAL_COUNT + k, _wapi_handle_typename[handle->type]);
-
- shared_data = &_wapi_shared_layout->handles[handle->u.shared.offset];
-
- DEBUG ("%s: (%d) Updating timestamp of handle 0x%x", __func__, _wapi_getpid (), handle->u.shared.offset);
-
- InterlockedExchange ((gint32 *)&shared_data->timestamp, now);
- } else if (handle->type == WAPI_HANDLE_FILE) {
- struct _WapiHandle_file *file_handle = &handle->u.file;
-
- DEBUG ("%s: (%d) handle 0x%x is FILE", __func__, _wapi_getpid (), i * _WAPI_HANDLE_INITIAL_COUNT + k);
-
- g_assert (file_handle->share_info != NULL);
-
- DEBUG ("%s: (%d) Inc refs on fileshare 0x%x", __func__, _wapi_getpid (), (file_handle->share_info - &_wapi_fileshare_layout->share_info[0]) / sizeof(struct _WapiFileShare));
-
- InterlockedExchange ((gint32 *)&file_handle->share_info->timestamp, now);
- }
- }
- }
- }
-
- thr_ret = mono_os_mutex_unlock (&scan_mutex);
- g_assert (thr_ret == 0);
-
- thr_ret = _wapi_shm_sem_unlock (_WAPI_SHARED_SEM_FILESHARE);
-
- _wapi_handle_unlock_shared_handles ();
-}
-