bitcoin_checkqueue/control.rs
1crate::ix!();
2
3/**
4 | RAII-style controller object for a
5 | CCheckQueue that guarantees the passed
6 | queue is finished before continuing.
7 |
8 */
9pub struct CheckQueueControl<T> {
10 pqueue: *const CheckQueue<T>,
11 done: bool,
12}
13
14impl<T> Drop for CheckQueueControl<T> {
15 fn drop(&mut self) {
16 todo!();
17 /*
18 if (!fDone)
19 Wait();
20 if (pqueue != nullptr) {
21 LEAVE_CRITICAL_SECTION(pqueue->m_control_mutex);
22 }
23 */
24 }
25}
26
27impl<T> CheckQueueControl<T> {
28
29 pub fn new(pqueue_in: *mut CheckQueue<T>) -> Self {
30
31 todo!();
32 /*
33 : pqueue(pqueueIn),
34 : done(false),
35
36 // passed queue is supposed to be unused, or nullptr
37 if (pqueue != nullptr) {
38 ENTER_CRITICAL_SECTION(pqueue->m_control_mutex);
39 }
40 */
41 }
42
43 pub fn wait(&mut self) -> bool {
44
45 todo!();
46 /*
47 if (pqueue == nullptr)
48 return true;
49 bool fRet = pqueue->Wait();
50 fDone = true;
51 return fRet;
52 */
53 }
54
55 pub fn add(&mut self, checks: &mut Vec<T>) {
56
57 todo!();
58 /*
59 if (pqueue != nullptr)
60 pqueue->Add(vChecks);
61 */
62 }
63}
64