about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-04-22 17:15:31 -0700
committerBrian Anderson <banderson@mozilla.com>2013-04-22 17:15:31 -0700
commit42c0f88232847e97e6cf3578ef197d1942bba44d (patch)
tree6167cb170f891dad4674e2c186f785d6a0160b5d /src/rt/rust_builtin.cpp
parent5fbb0949a53a6ac51c6d9b187ef4c464e52ae536 (diff)
downloadrust-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.cpp22
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++