snaplock: snaplock_timer.cpp Source File

snaplock  1.7.14
The multi-computer lock service.
snaplock_timer.cpp
Go to the documentation of this file.
1 /*
2  * Text:
3  * snaplock/src/snaplock_timer.cpp
4  *
5  * Description:
6  * A daemon to synchronize processes between any number of computers
7  * by blocking all of them but one.
8  *
9  * The timer implementation is used to know when a lock times out. The
10  * cleanup() function determines when the next timeout happens and saves
11  * that in this timer. When a timeout happens, the process calls cleanup()
12  * which removes all the old locks and makes sure the next ones get
13  * handled as expected.
14  *
15  * License:
16  * Copyright (c) 2016-2019 Made to Order Software Corp. All Rights Reserved
17  *
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining a
22  * copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be included
30  * in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
35  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
36  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
37  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
38  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  */
40 
41 
42 // ourselves
43 //
44 #include "snaplock.h"
45 
46 // our lib
47 //
48 #include <snapwebsites/log.h>
49 
50 
51 namespace snaplock
52 {
53 
75  : snap_timer(-1)
76  , f_snaplock(sl)
77 {
78  set_name("snaplock timer");
79 }
80 
81 
88 {
89  // we simulate the STOP, so pass 'false' (i.e. not quitting)
90  //
92 }
93 
94 
95 }
96 // snaplock namespace
97 // vim: ts=4 sw=4 et
void cleanup()
Clean timed out entries if any.
Definition: snaplock.cpp:3903
snaplock_timer(snaplock *sl)
The timer initialization.
virtual void process_timeout() override
Call the cleanup() function of the snaplock object.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly