1 /* 2 BAREOS® - Backup Archiving REcovery Open Sourced 3 4 Copyright (C) 2003-2007 Free Software Foundation Europe e.V. 5 Copyright (C) 2016-2016 Bareos GmbH & Co. KG 6 7 This program is Free Software; you can redistribute it and/or 8 modify it under the terms of version three of the GNU Affero General Public 9 License as published by the Free Software Foundation and included 10 in the file LICENSE. 11 12 This program is distributed in the hope that it will be useful, but 13 WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Affero General Public License for more details. 16 17 You should have received a copy of the GNU Affero General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20 02110-1301, USA. 21 */ 22 /* 23 * Nic Bellamy <nic@bellamy.co.nz>, October 2003. 24 * 25 */ 26 /** 27 * @file 28 * Process and thread timer routines, built on top of watchdogs. 29 */ 30 31 #ifndef BAREOS_LIB_BTIMERS_H_ 32 #define BAREOS_LIB_BTIMERS_H_ 33 34 #include "lib/timer_thread.h" 35 #include "lib/watchdog.h" 36 37 class BareosSocket; 38 39 struct btimer_t { 40 watchdog_t* wd; /**< Parent watchdog */ 41 int type; 42 bool killed; 43 pid_t pid; /**< process id if TYPE_CHILD */ 44 pthread_t tid; /**< thread id if TYPE_PTHREAD */ 45 BareosSocket* bsock; /**< Pointer to BareosSocket */ 46 JobControlRecord* jcr; /**< Pointer to job control record */ 47 }; 48 49 btimer_t* start_child_timer(JobControlRecord* jcr, pid_t pid, uint32_t wait); 50 void StopChildTimer(btimer_t* wid); 51 btimer_t* start_thread_timer(JobControlRecord* jcr, 52 pthread_t tid, 53 uint32_t wait); 54 void StopThreadTimer(btimer_t* wid); 55 btimer_t* StartBsockTimer(BareosSocket* bs, uint32_t wait); 56 void StopBsockTimer(btimer_t* wid); 57 58 #endif /* BAREOS_LIB_BTIMERS_H_ */ 59