static struct list vectored_handlers = LIST_INIT(vectored_handlers);
-static RTL_RWLOCK vectored_handlers_lock;
-
-/**********************************************************************
- * exceptions_init
- *
- * Initialize read/write lock used by the vectored exception handling.
- */
-void exceptions_init(void)
+static RTL_CRITICAL_SECTION vectored_handlers_section;
+static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
{
- RtlInitializeResource(&vectored_handlers_lock);
-}
+ 0, 0, &vectored_handlers_section,
+ { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": vectored_handlers_section") }
+};
+static RTL_CRITICAL_SECTION vectored_handlers_section = { &critsect_debug, -1, 0, 0, 0, 0 };
/**********************************************************************
* wait_suspend
except_ptrs.ExceptionRecord = rec;
except_ptrs.ContextRecord = context;
- RtlAcquireResourceShared( &vectored_handlers_lock, TRUE );
+ RtlEnterCriticalSection( &vectored_handlers_section );
LIST_FOR_EACH( ptr, &vectored_handlers )
{
VECTORED_HANDLER *handler = LIST_ENTRY( ptr, VECTORED_HANDLER, entry );
TRACE( "handler at %p returned %x\n", handler->func, ret );
if (ret == EXCEPTION_CONTINUE_EXECUTION) break;
}
- RtlReleaseResource( &vectored_handlers_lock );
+ RtlLeaveCriticalSection( &vectored_handlers_section );
return ret;
}
if (handler)
{
handler->func = func;
- RtlAcquireResourceExclusive( &vectored_handlers_lock, TRUE );
+ RtlEnterCriticalSection( &vectored_handlers_section );
if (first) list_add_head( &vectored_handlers, &handler->entry );
else list_add_tail( &vectored_handlers, &handler->entry );
- RtlReleaseResource( &vectored_handlers_lock );
+ RtlLeaveCriticalSection( &vectored_handlers_section );
}
return handler;
}
struct list *ptr;
ULONG ret = FALSE;
- RtlAcquireResourceExclusive( &vectored_handlers_lock, TRUE );
+ RtlEnterCriticalSection( &vectored_handlers_section );
LIST_FOR_EACH( ptr, &vectored_handlers )
{
VECTORED_HANDLER *curr_handler = LIST_ENTRY( ptr, VECTORED_HANDLER, entry );
break;
}
}
- RtlReleaseResource( &vectored_handlers_lock );
+ RtlLeaveCriticalSection( &vectored_handlers_section );
if (ret) RtlFreeHeap( GetProcessHeap(), 0, handler );
return ret;
}