Skip to content

Commit 407bffb

Browse files
committed
std: Remove at_exit API. Unused
1 parent 23b7ee2 commit 407bffb

File tree

6 files changed

+0
-172
lines changed

6 files changed

+0
-172
lines changed

src/libstd/unstable/at_exit.rs

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/libstd/unstable/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ use libc;
1616
use prelude::*;
1717
use task;
1818

19-
pub mod at_exit;
20-
2119
pub mod dynamic_lib;
2220

2321
pub mod finally;

src/rt/rust_builtin.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -757,12 +757,6 @@ rust_raw_thread_join_delete(raw_thread *thread) {
757757
delete thread;
758758
}
759759

760-
extern "C" void
761-
rust_register_exit_function(spawn_fn runner, fn_env_pair *f) {
762-
rust_task *task = rust_get_current_task();
763-
task->kernel->register_exit_function(runner, f);
764-
}
765-
766760
#ifndef _WIN32
767761
#include <sys/types.h>
768762
#include <dirent.h>

src/rt/rust_kernel.cpp

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ rust_kernel::rust_kernel(rust_env *env) :
3131
sched_reaper(this),
3232
osmain_driver(NULL),
3333
non_weak_tasks(0),
34-
at_exit_runner(NULL),
35-
at_exit_started(false),
3634
env(env)
3735
{
3836
// Create the single threaded scheduler that will run on the platform's
@@ -310,54 +308,9 @@ rust_kernel::begin_shutdown() {
310308
}
311309
}
312310

313-
run_exit_functions();
314311
allow_scheduler_exit();
315312
}
316313

317-
void
318-
rust_kernel::register_exit_function(spawn_fn runner, fn_env_pair *f) {
319-
scoped_lock with(at_exit_lock);
320-
321-
assert(!at_exit_started && "registering at_exit function after exit");
322-
323-
if (at_exit_runner) {
324-
// FIXME #2912 Would be very nice to assert this but we can't because
325-
// of the way coretest works (the test case ends up using its own
326-
// function)
327-
//assert(runner == at_exit_runner
328-
// && "there can be only one at_exit_runner");
329-
}
330-
331-
at_exit_runner = runner;
332-
at_exit_fns.push_back(f);
333-
}
334-
335-
void
336-
rust_kernel::run_exit_functions() {
337-
rust_task *task;
338-
339-
{
340-
scoped_lock with(at_exit_lock);
341-
342-
assert(!at_exit_started && "running exit functions twice?");
343-
344-
at_exit_started = true;
345-
346-
if (at_exit_runner == NULL) {
347-
return;
348-
}
349-
350-
rust_scheduler *sched = get_scheduler_by_id(main_sched_id());
351-
assert(sched);
352-
task = sched->create_task(NULL, "at_exit");
353-
354-
final_exit_fns.count = at_exit_fns.size();
355-
final_exit_fns.start = at_exit_fns.data();
356-
}
357-
358-
task->start(at_exit_runner, NULL, &final_exit_fns);
359-
}
360-
361314
//
362315
// Local Variables:
363316
// mode: C++

src/rt/rust_kernel.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ typedef intptr_t rust_task_id;
6363

6464
typedef std::map<rust_sched_id, rust_scheduler*> sched_map;
6565

66-
// This is defined as a struct only because we need a single pointer to pass
67-
// to the Rust function that runs the at_exit functions
68-
struct exit_functions {
69-
size_t count;
70-
fn_env_pair **start;
71-
};
72-
7366
class rust_kernel {
7467
rust_exchange_alloc exchange_alloc;
7568
rust_log _log;
@@ -114,14 +107,6 @@ class rust_kernel {
114107
void allow_scheduler_exit();
115108
void begin_shutdown();
116109

117-
lock_and_signal at_exit_lock;
118-
spawn_fn at_exit_runner;
119-
bool at_exit_started;
120-
std::vector<fn_env_pair*> at_exit_fns;
121-
exit_functions final_exit_fns;
122-
123-
void run_exit_functions();
124-
125110
public:
126111
struct rust_env *env;
127112

@@ -156,7 +141,6 @@ class rust_kernel {
156141
void inc_live_count();
157142
void dec_live_count();
158143

159-
void register_exit_function(spawn_fn runner, fn_env_pair *f);
160144
};
161145

162146
template <typename T> struct kernel_owned {

src/rt/rustrt.def.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ linenoiseHistorySave
214214
linenoiseHistoryLoad
215215
rust_raw_thread_start
216216
rust_raw_thread_join_delete
217-
rust_register_exit_function
218217
rust_get_rt_tls_key
219218
swap_registers
220219
rust_readdir

0 commit comments

Comments
 (0)