<child>
<widget class="GtkHBox" id="hbox28">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label63">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Job:</property>
<child>
<widget class="GtkHBox" id="hbox30">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label66">
- <property name="width_request">65</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Client:</property>
<child>
<widget class="GtkHBox" id="hbox31">
+ <property name="border_width">1</property>
+ <property name="width_request">503</property>
+ <property name="height_request">26</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label68">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">FileSet: </property>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label156">
+ <property name="width_request">13</property>
+ <property name="height_request">16</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="view_fileset_button">
- <property name="width_request">93</property>
- <property name="height_request">26</property>
+ <widget class="GtkLabel" id="label155">
+ <property name="width_request">52</property>
+ <property name="height_request">16</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Priority:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton1">
+ <property name="width_request">81</property>
+ <property name="height_request">24</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes"> View FileSet </property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <signal name="clicked" handler="on_view_fileset_clicked"/>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">10 0 100 1 10 10</property>
</widget>
<packing>
- <property name="padding">10</property>
+ <property name="padding">4</property>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label69">
+ <widget class="GtkLabel" id="label157">
+ <property name="width_request">100</property>
+ <property name="height_request">16</property>
<property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
+ <property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="ypad">0</property>
</widget>
<packing>
- <property name="padding">65</property>
+ <property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
<child>
<widget class="GtkHBox" id="hbox32">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label70">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Level:</property>
<child>
<widget class="GtkHBox" id="hbox33">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label72">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Pool:</property>
<child>
<widget class="GtkHBox" id="hbox39">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label96">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Storage:</property>
<child>
<widget class="GtkHBox" id="hbox40">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label98">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Messages:</property>
<child>
<widget class="GtkHBox" id="hbox34">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label77">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Where: </property>
<child>
<widget class="GtkHBox" id="hbox41">
+ <property name="border_width">1</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label100">
- <property name="width_request">66</property>
+ <property name="width_request">68</property>
<property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes">When:</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox60">
+ <property name="border_width">1</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label153">
+ <property name="width_request">68</property>
+ <property name="height_request">16</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Bootstrap:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="entry28">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label154">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">36</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
<child>
<widget class="GtkLabel" id="label84">
+ <property name="width_request">12</property>
+ <property name="height_request">19</property>
<property name="visible">True</property>
<property name="label" translatable="yes"> </property>
<property name="use_underline">False</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
- <property name="default_width">640</property>
- <property name="default_height">400</property>
+ <property name="default_width">700</property>
+ <property name="default_height">450</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<signal name="delete_event" handler="on_restore_files_delete_event" last_modification_time="Tue, 16 Mar 2004 11:41:52 GMT"/>
</child>
<child>
- <widget class="GtkScrolledWindow" id="scrolled">
+ <widget class="GtkHPaned" id="hpaned1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <placeholder/>
+ <widget class="GtkScrolledWindow" id="tree">
+ <property name="width_request">164</property>
+ <property name="height_request">78</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="shrink">True</property>
+ <property name="resize">True</property>
+ </packing>
</child>
</widget>
<packing>
<child>
<widget class="GtkHBox" id="hbox44">
+ <property name="width_request">301</property>
+ <property name="height_request">30</property>
<property name="visible">True</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
- <widget class="GtkLabel" id="label115">
+ <widget class="GtkLabel" id="FilesSelected">
<property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
+ <property name="label" translatable="yes">Files Selected: </property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
- <property name="xalign">0.94</property>
+ <property name="xalign">0.02</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<child>
<widget class="GtkButton" id="restore_select_ok">
+ <property name="width_request">72</property>
+ <property name="height_request">30</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
</child>
<child>
- <widget class="GtkLabel" id="label116">
+ <widget class="GtkLabel" id="label152">
+ <property name="width_request">34</property>
+ <property name="height_request">16</property>
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
</child>
<child>
- <widget class="GtkLabel" id="label117">
+ <widget class="GtkLabel" id="label1001">
<property name="visible">True</property>
- <property name="label" translatable="yes"></property>
+ <property name="label" translatable="yes"> </property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="ypad">0</property>
</widget>
<packing>
- <property name="padding">0</property>
+ <property name="padding">8</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
- <property name="padding">7</property>
+ <property name="padding">5</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
+<widget class="GtkDialog" id="progress dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Progress</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox11">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area10">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="closebutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-7</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox19">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1002">
+ <property name="width_request">0</property>
+ <property name="height_request">43</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1003">
+ <property name="width_request">0</property>
+ <property name="height_request">36</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkProgressBar" id="progressbar1">
+ <property name="width_request">150</property>
+ <property name="height_request">33</property>
+ <property name="visible">True</property>
+ <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
+ <property name="fraction">0</property>
+ <property name="pulse_step">0.1</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1004">
+ <property name="width_request">0</property>
+ <property name="height_request">52</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
--- /dev/null
+/*
+ * Process and thread timer routines, built on top of watchdogs.
+ *
+ * Nic Bellamy <nic@bellamy.co.nz>, October 2004.
+ *
+*/
+/*
+ Copyright (C) 2000-2004 Kern Sibbald and John Walker
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+ */
+
+#include "bacula.h"
+#include "jcr.h"
+
+/* Forward referenced functions */
+static void stop_btimer(btimer_t *wid);
+static btimer_t *btimer_start_common(uint32_t wait);
+
+/* Forward referenced callback functions */
+static void callback_child_timer(watchdog_t *self);
+static void callback_thread_timer(watchdog_t *self);
+#ifdef xxx
+static void destructor_thread_timer(watchdog_t *self);
+static void destructor_child_timer(watchdog_t *self);
+#endif
+
+/*
+ * Start a timer on a child process of pid, kill it after wait seconds.
+ *
+ * Returns: btimer_t *(pointer to btimer_t struct) on success
+ * NULL on failure
+ */
+btimer_t *start_child_timer(pid_t pid, uint32_t wait)
+{
+ btimer_t *wid;
+
+ wid = btimer_start_common(wait);
+ if (wid == NULL) {
+ return NULL;
+ }
+ wid->type = TYPE_CHILD;
+ wid->pid = pid;
+ wid->killed = false;
+
+ wid->wd->callback = callback_child_timer;
+ wid->wd->one_shot = false;
+ wid->wd->interval = wait;
+ register_watchdog(wid->wd);
+
+ Dmsg3(200, "Start child timer %p, pid %d for %d secs.\n", wid, pid, wait);
+ return wid;
+}
+
+/*
+ * Stop child timer
+ */
+void stop_child_timer(btimer_t *wid)
+{
+ if (wid == NULL) {
+ Dmsg0(200, "stop_child_timer called with NULL btimer_id\n");
+ return;
+ }
+ Dmsg2(200, "Stop child timer %p pid %d\n", wid, wid->pid);
+ stop_btimer(wid);
+}
+
+#ifdef xxx
+static void destructor_child_timer(watchdog_t *self)
+{
+ btimer_t *wid = (btimer_t *)self->data;
+ free(wid->wd);
+ free(wid);
+}
+#endif
+
+static void callback_child_timer(watchdog_t *self)
+{
+ btimer_t *wid = (btimer_t *)self->data;
+
+ if (!wid->killed) {
+ /* First kill attempt; try killing it softly (kill -SONG) first */
+ wid->killed = true;
+
+ Dmsg2(200, "watchdog %p term PID %d\n", self, wid->pid);
+
+ /* Kill -TERM the specified PID, and reschedule a -KILL for 3 seconds
+ * later.
+ */
+ kill(wid->pid, SIGTERM);
+ self->interval = 3;
+ } else {
+ /* This is the second call - terminate with prejudice. */
+ Dmsg2(200, "watchdog %p kill PID %d\n", self, wid->pid);
+
+ kill(wid->pid, SIGKILL);
+
+ /* Setting one_shot to true before we leave ensures we don't get
+ * rescheduled.
+ */
+ self->one_shot = true;
+ }
+}
+
+/*
+ * Start a timer on a thread. kill it after wait seconds.
+ *
+ * Returns: btimer_t *(pointer to btimer_t struct) on success
+ * NULL on failure
+ */
+btimer_t *start_thread_timer(pthread_t tid, uint32_t wait)
+{
+ btimer_t *wid;
+ wid = btimer_start_common(wait);
+ if (wid == NULL) {
+ return NULL;
+ }
+ wid->type = TYPE_PTHREAD;
+ wid->tid = tid;
+
+ wid->wd->callback = callback_thread_timer;
+ wid->wd->one_shot = true;
+ wid->wd->interval = wait;
+ register_watchdog(wid->wd);
+
+ Dmsg3(200, "Start thread timer %p tid %p for %d secs.\n", wid, tid, wait);
+
+ return wid;
+}
+
+/*
+ * Start a timer on a BSOCK. kill it after wait seconds.
+ *
+ * Returns: btimer_t *(pointer to btimer_t struct) on success
+ * NULL on failure
+ */
+btimer_t *start_bsock_timer(BSOCK *bsock, uint32_t wait)
+{
+ btimer_t *wid;
+ wid = btimer_start_common(wait);
+ if (wid == NULL) {
+ return NULL;
+ }
+ wid->type = TYPE_BSOCK;
+ wid->tid = pthread_self();
+ wid->bsock = bsock;
+
+ wid->wd->callback = callback_thread_timer;
+ wid->wd->one_shot = true;
+ wid->wd->interval = wait;
+ register_watchdog(wid->wd);
+
+ Dmsg3(200, "Start thread timer %p tip %p for %d secs.\n", wid, wid->tid, wait);
+
+ return wid;
+}
+
+/*
+ * Stop bsock timer
+ */
+void stop_bsock_timer(btimer_t *wid)
+{
+ if (wid == NULL) {
+ Dmsg0(200, "stop_bsock_timer called with NULL btimer_id\n");
+ return;
+ }
+ Dmsg2(200, "Stop bsock timer %p tid %p.\n", wid, wid->tid);
+ stop_btimer(wid);
+}
+
+
+/*
+ * Stop thread timer
+ */
+void stop_thread_timer(btimer_t *wid)
+{
+ if (wid == NULL) {
+ Dmsg0(200, "stop_thread_timer called with NULL btimer_id\n");
+ return;
+ }
+ Dmsg2(200, "Stop thread timer %p tid %p.\n", wid, wid->tid);
+ stop_btimer(wid);
+}
+
+#ifdef xxx
+static void destructor_thread_timer(watchdog_t *self)
+{
+ btimer_t *wid = (btimer_t *)self->data;
+ free(wid->wd);
+ free(wid);
+}
+#endif
+
+static void callback_thread_timer(watchdog_t *self)
+{
+ btimer_t *wid = (btimer_t *)self->data;
+
+ Dmsg2(200, "watchdog %p kill thread %d\n", self, wid->tid);
+
+ if (wid->type == TYPE_BSOCK && wid->bsock) {
+ Dmsg0(200, "kill type bsock ...\n");
+ wid->bsock->timed_out = true;
+ }
+ pthread_kill(wid->tid, TIMEOUT_SIGNAL);
+}
+
+static btimer_t *btimer_start_common(uint32_t wait)
+{
+ btimer_t *wid = (btimer_t *)malloc(sizeof(btimer_t));
+
+ wid->wd = new_watchdog();
+ if (wid->wd == NULL) {
+ free(wid);
+ return NULL;
+ }
+ wid->wd->data = wid;
+ wid->killed = FALSE;
+
+ return wid;
+}
+
+/*
+ * Stop btimer
+ */
+static void stop_btimer(btimer_t *wid)
+{
+ if (wid == NULL) {
+ Emsg0(M_ABORT, 0, "stop_btimer called with NULL btimer_id\n");
+ }
+ unregister_watchdog(wid->wd);
+ free(wid->wd);
+ free(wid);
+}