diff options
Diffstat (limited to 'src/tests/minicron.cpp')
-rw-r--r-- | src/tests/minicron.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/tests/minicron.cpp b/src/tests/minicron.cpp deleted file mode 100644 index aed63e2..0000000 --- a/src/tests/minicron.cpp +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #include "bu/minicron.h" | ||
9 | #include "bu/sio.h" | ||
10 | |||
11 | #include <unistd.h> | ||
12 | |||
13 | using namespace Bu; | ||
14 | |||
15 | Bu::MiniCron mCron; | ||
16 | |||
17 | void job0( Bu::MiniCron::Job &job ) | ||
18 | { | ||
19 | sio << time( NULL ) << ": job0( id = " << job.getId() << ", count = " | ||
20 | << job.getRunCount() << ")" << sio.nl; | ||
21 | } | ||
22 | |||
23 | void job1( Bu::MiniCron::Job &job ) | ||
24 | { | ||
25 | sio << time( NULL ) << ": job1( id = " << job.getId() << ", count = " | ||
26 | << job.getRunCount() << ")" << sio.nl; | ||
27 | mCron.removeJob( 4 ); | ||
28 | } | ||
29 | |||
30 | void job2( Bu::MiniCron::Job &job ) | ||
31 | { | ||
32 | sio << time( NULL ) << ": job2( id = " << job.getId() << ", count = " | ||
33 | << job.getRunCount() << ")" << sio.nl; | ||
34 | } | ||
35 | |||
36 | void job3( Bu::MiniCron::Job &job ) | ||
37 | { | ||
38 | sio << time( NULL ) << ": job3( id = " << job.getId() << ", count = " | ||
39 | << job.getRunCount() << ")" << sio.nl; | ||
40 | } | ||
41 | |||
42 | int main() | ||
43 | { | ||
44 | mCron.addJob( | ||
45 | "job0", slot( &job0 ), MiniCron::TimerInterval( time(NULL)+3, 5 ) ); | ||
46 | mCron.addJob( | ||
47 | "job1", slot( &job1 ), MiniCron::TimerInterval( time(NULL)+10, 8 ) ); | ||
48 | mCron.addJob( | ||
49 | "job2", slot( &job2 ), MiniCron::TimerBasic("weekly wed 17") ); | ||
50 | mCron.addJob( | ||
51 | "job3", slot( &job3 ), MiniCron::TimerInterval( time(NULL)+1, 2 ) ); | ||
52 | |||
53 | sio << time( NULL ) << ": Program started." << sio.nl; | ||
54 | |||
55 | for(;;) | ||
56 | { | ||
57 | usleep( 50000 ); | ||
58 | mCron.poll(); | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||