-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproc_container_timer.H
67 lines (50 loc) · 1.6 KB
/
proc_container_timer.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
** Copyright 2022 Double Precision, Inc.
** See COPYING for distribution information.
*/
#ifndef proc_container_timer_h
#define proc_container_timer_h
#include <unistd.h>
#include <functional>
#include <memory>
#include <map>
#include <time.h>
#include "proc_containerfwd.H"
#include "proc_container_timerfwd.H"
#include "current_containers_infofwd.H"
class proc_container_timerObj;
typedef std::multimap<time_t, std::weak_ptr<proc_container_timerObj>
> current_timers_t;
class proc_container_timerObj {
public:
/*! create_timer() constructs this, inserts current_timers, set my_iter
*/
proc_container_timerObj(
const current_containers_info &all_containers,
const proc_container &container,
time_t time_start,
time_t time_end,
const std::function<void (
const current_containers_callback_info &
)> &done);
//! Destructor removes this from my_iter, if it's not end()
~proc_container_timerObj();
current_timers_t::iterator my_iter;
const time_t time_start;
const time_t time_end;
std::weak_ptr<current_containers_infoObj> all_containers;
std::weak_ptr<const proc_containerObj> container;
std::function<void (const current_containers_callback_info &)> done;
};
//! Create a new timer.
//! Returns a proc_container_timer handle. Destroying the handle cancels the
//! timer.
proc_container_timer create_timer(
const current_containers_info &all_containers,
const proc_container &container,
time_t timeout,
const std::function<void (const current_containers_callback_info &
)> &done
);
void update_timer_containers(const current_containers &new_current_containers);
#endif