diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-04-22 17:15:31 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-04-22 17:15:31 -0700 |
| commit | 42c0f88232847e97e6cf3578ef197d1942bba44d (patch) | |
| tree | 6167cb170f891dad4674e2c186f785d6a0160b5d /src/rt/rust_builtin.cpp | |
| parent | 5fbb0949a53a6ac51c6d9b187ef4c464e52ae536 (diff) | |
| download | rust-42c0f88232847e97e6cf3578ef197d1942bba44d.tar.gz rust-42c0f88232847e97e6cf3578ef197d1942bba44d.zip | |
core::rt: Add unwinding to newsched tasks
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index b8749b8f73d..b37644460aa 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -886,6 +886,28 @@ rust_boxed_region_free(boxed_region *region, rust_opaque_box *box) { region->free(box); } +typedef void *(rust_try_fn)(void*, void*); + +extern "C" CDECL uintptr_t +rust_try(rust_try_fn f, void *fptr, void *env) { + try { + f(fptr, env); + } catch (uintptr_t token) { + assert(token != 0); + return token; + } + return 0; +} + +extern "C" CDECL void +rust_begin_unwind(uintptr_t token) { +#ifndef __WIN32__ + throw token; +#else + abort("failing on win32"); +#endif +} + // // Local Variables: // mode: C++ |
