]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/lock.c
Apply Joao's patch to SQLite tables to make chars work.
[bacula/bacula] / bacula / src / stored / lock.c
index a52ff4e5e369ba9432362c3d28ad79ab96f95776..aea4b6a2039a2d940ffc1390c01796d4037b1820 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -88,13 +88,14 @@ const int dbglvl = 500;
  *   DEVICE::dlock()   does P(m_mutex)     (in dev.h)
  *   DEVICE::dunlock() does V(m_mutex)
  *
- *   DEVICE::r_dlock() does recursive locking
+ *   DEVICE::r_dlock() allows locking the device when this thread
+                         already has the device blocked.
  *                    dlock()
  *                    if blocked and not same thread that locked
  *                       pthread_cond_wait
  *                    leaves device locked 
  *
- *   DEVICE::r_dunlock()
+ *   DEVICE::r_dunlock() unlocks but does not unblock
  *                    same as dunlock();
  *
  *   DEVICE::dblock(why)  does 
@@ -208,8 +209,11 @@ void DEVICE::r_dlock()
    if (this->blocked() && !pthread_equal(this->no_wait_id, pthread_self())) {
       this->num_waiting++;             /* indicate that I am waiting */
       while (this->blocked()) {
+#ifndef HAVE_WIN32
+         /* thread id on Win32 may be a struct */
          Dmsg3(sd_dbglvl, "r_dlock blked=%s no_wait=%p me=%p\n", this->print_blocked(),
                this->no_wait_id, pthread_self());
+#endif
          if ((stat = pthread_cond_wait(&this->wait, &m_mutex)) != 0) {
             berrno be;
             this->dunlock();
@@ -247,7 +251,7 @@ void _unblock_device(const char *file, int line, DEVICE *dev)
    Dmsg3(sd_dbglvl, "unblock %s from %s:%d\n", dev->print_blocked(), file, line);
    ASSERT(dev->blocked());
    dev->set_blocked(BST_NOT_BLOCKED);
-   dev->no_wait_id = 0;
+   clear_thread_id(dev->no_wait_id);
    if (dev->num_waiting > 0) {
       pthread_cond_broadcast(&dev->wait); /* wake them up */
    }