Sfoglia il codice sorgente

! untested changes

channel
Ludovic 'Archivist' Lagouardette 3 anni fa
parent
commit
128ac50562
1 ha cambiato i file con 20 aggiunte e 2 eliminazioni
  1. +20
    -2
      include/gp/vfs/process_data.hpp

+ 20
- 2
include/gp/vfs/process_data.hpp Vedi File

@ -21,6 +21,16 @@ namespace gp {
using pid_t = size_t;
struct base_process_info {
virtual void initialize() {}
virtual void checkpoint() {}
virtual void restore() {}
virtual void switch_in() {}
virtual void switch_out() {}
virtual void cleanup() {}
virtual ~base_process_info() {}
};
struct process_data{
pid_t pid;
gp::function<void()> fn;
@ -29,14 +39,15 @@ namespace gp {
gp::process_status state;
std::atomic_bool is_running;
[[no_unique_address]] gp::specifics::platform_data specifics;
gp::indexed_array<gp::file_description*, gp_config::limits::max_fd_per_process> fds;
gp::unique_ptr<base_process_info> info;
process_data(gp::function<void()> _fn, void* _stack, size_t _stack_sz)
process_data(gp::function<void()> _fn, void* _stack, size_t _stack_sz, gp::unique_ptr<base_process_info>&& _info)
: fn(_fn)
, stack(_stack)
, stack_sz(_stack_sz)
, state(gp::process_status::inactive)
, specifics(gp::buffer<char>{(char*)stack, stack_sz})
, info(_info)
{}
process_data(process_data&& v)
@ -45,7 +56,14 @@ namespace gp {
, stack_sz(v.stack_sz)
, state(v.state)
, specifics(v.specifics)
, info(gp::move(v.info))
{}
~process_data() {
if(info) {
info->cleanup();
}
}
};
}

Caricamento…
Annulla
Salva