Пример #1
0
void caml_raise(value v)
{
  Unlock_exn();
  if (caml_exception_pointer == NULL) caml_fatal_uncaught_exception(v);

#ifndef Stack_grows_upwards
#define PUSHED_AFTER <
#else
#define PUSHED_AFTER >
#endif
  while (caml_local_roots != NULL &&
         (char *) caml_local_roots PUSHED_AFTER caml_exception_pointer) {
    caml_local_roots = caml_local_roots->next;
  }
#undef PUSHED_AFTER

  caml_raise_exception(v);
}
Пример #2
0
void caml_raise(value v)
{
  if (Caml_state->system_exnptr_offset == 0)
    caml_fatal_uncaught_exception(v);

  char* exception_pointer = Caml_state->system_stack_high
                          - Caml_state->system_exnptr_offset;
  while (CAML_LOCAL_ROOTS != NULL &&
         (char *) CAML_LOCAL_ROOTS < exception_pointer) {
    Assert(CAML_LOCAL_ROOTS != NULL);
    struct caml__mutex_unwind* m = CAML_LOCAL_ROOTS->mutexes;
    while (m) {
      /* unlocked in reverse order of locking */
      caml_plat_unlock(m->mutex);
      m = m->next;
    }
    CAML_LOCAL_ROOTS = CAML_LOCAL_ROOTS->next;
  }

  caml_raise_exception(Caml_state->young_ptr, v);
}