Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (66 sloc) 1.816 kB
#ifndef RBX_SIGNAL_HPP
#define RBX_SIGNAL_HPP
#include "gc/root.hpp"
#include "util/thread.hpp"
#include <list>
#include <string>
namespace rubinius {
class Object;
class VM;
class State;
class Configuration;
struct CallFrame;
class SignalThread {
SharedState& shared_;
VM* vm_;
bool system_exit_;
int exit_code_;
const static int pending_signal_size_ = 256;
int pending_signals_[pending_signal_size_];
int queue_index_;
int process_index_;
std::list<int> watched_signals_;
utilities::thread::SpinLock watch_lock_;
utilities::thread::Condition condition_;
utilities::thread::Mutex lock_;
public:
const static int stack_size = 0x100000;
enum HandlerType {
eDefault,
eIgnore,
eCustom
};
SignalThread(STATE, VM* vm);
SharedState& shared() {
return shared_;
}
VM* vm() {
return vm_;
}
void system_exit(Object* exit_code) {
utilities::thread::Mutex::LockGuard guard(lock_);
set_exit_code(exit_code);
system_exit_ = true;
atomic::memory_barrier();
condition_.signal();
}
void set_exit_code(Object* exit_code);
static VM* new_vm(STATE);
static void* run(void* ptr);
static void signal_handler(int signal);
void install_default_handlers();
void initialize(STATE);
void start(STATE);
void restart(STATE);
void run(STATE);
void stop(STATE);
void after_fork_child(STATE);
void queue_signal(int signal);
void add_signal_handler(State*, int signal, HandlerType type = eCustom);
void print_backtraces();
typedef void (*PrintFunction)(const char* message, ...);
void print_machine_info(PrintFunction function);
void print_process_info(PrintFunction function);
};
}
#endif
Jump to Line
Something went wrong with that request. Please try again.