diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-05-01 10:29:47 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-05-01 10:30:54 -0400 |
| commit | 4af2d90af59bb5e28e5d114d8a6004d68fad3bd5 (patch) | |
| tree | c5be284688af69a2843258f71511686827bc21d1 /src/rt/rust_task.cpp | |
| parent | 84861101eca12942b42f36f8adb18cfc74515431 (diff) | |
| download | rust-4af2d90af59bb5e28e5d114d8a6004d68fad3bd5.tar.gz rust-4af2d90af59bb5e28e5d114d8a6004d68fad3bd5.zip | |
add an option to debug borrows (RUST_DEBUG_BORROW) so you can
find out where the offending borrow occurred. This ... still needs some work.
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index e6293aa5c1d..ea42936f2e5 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -42,6 +42,7 @@ rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state, total_stack_sz(0), task_local_data(NULL), task_local_data_cleanup(NULL), + borrow_list(NULL), state(state), cond(NULL), cond_name("none"), @@ -75,6 +76,16 @@ rust_task::delete_this() assert(ref_count == 0); // || // (ref_count == 1 && this == sched->root_task)); + if (borrow_list) { + // NOTE should free borrow_list from within rust code! + // If there is a pointer in there, it is a ~[BorrowRecord] pointer, + // which are currently allocated with LIBC malloc/free. But this is + // not really the right way to do this, we should be freeing this + // pointer from Rust code. + free(borrow_list); + borrow_list = NULL; + } + sched_loop->release_task(this); } |
