Browse Source

[1704] Update documentation

Mukund Sivaraman 13 years ago
parent
commit
865669e984
2 changed files with 27 additions and 1 deletions
  1. 20 0
      src/lib/util/interprocess_sync.h
  2. 7 1
      src/lib/util/interprocess_sync_file.h

+ 20 - 0
src/lib/util/interprocess_sync.h

@@ -62,10 +62,18 @@ public:
 protected:
 protected:
     /// \brief Acquire the lock (blocks if something else has acquired a
     /// \brief Acquire the lock (blocks if something else has acquired a
     /// lock on the same task name)
     /// lock on the same task name)
+    ///
+    /// \return Returns true if the lock was acquired, false otherwise.
     virtual bool lock() = 0;
     virtual bool lock() = 0;
+
     /// \brief Try to acquire a lock (doesn't block)
     /// \brief Try to acquire a lock (doesn't block)
+    ///
+    /// \return Returns true if the lock was acquired, false otherwise.
     virtual bool tryLock() = 0;
     virtual bool tryLock() = 0;
+
     /// \brief Release the lock
     /// \brief Release the lock
+    ///
+    /// \return Returns true if the lock was released, false otherwise.
     virtual bool unlock() = 0;
     virtual bool unlock() = 0;
 
 
     const std::string task_name_; ///< The task name
     const std::string task_name_; ///< The task name
@@ -80,6 +88,12 @@ protected:
 /// the description of InterprocessSync.
 /// the description of InterprocessSync.
 class InterprocessSyncLocker {
 class InterprocessSyncLocker {
 public:
 public:
+    /// \brief Constructor
+    ///
+    /// Creates a lock manager around a interprocess synchronization object
+    ///
+    /// \param sync The sync object which has to be locked/unlocked by
+    /// this locker object.
     InterprocessSyncLocker(InterprocessSync& sync) :
     InterprocessSyncLocker(InterprocessSync& sync) :
         sync_(sync)
         sync_(sync)
     {}
     {}
@@ -91,16 +105,22 @@ public:
 
 
     /// \brief Acquire the lock (blocks if something else has acquired a
     /// \brief Acquire the lock (blocks if something else has acquired a
     /// lock on the same task name)
     /// lock on the same task name)
+    ///
+    /// \return Returns true if the lock was acquired, false otherwise.
     bool lock() {
     bool lock() {
         return (sync_.lock());
         return (sync_.lock());
     }
     }
 
 
     /// \brief Try to acquire a lock (doesn't block)
     /// \brief Try to acquire a lock (doesn't block)
+    ///
+    /// \return Returns true if the lock was acquired, false otherwise.
     bool tryLock() {
     bool tryLock() {
         return (sync_.tryLock());
         return (sync_.tryLock());
     }
     }
 
 
     /// \brief Release the lock
     /// \brief Release the lock
+    ///
+    /// \return Returns true if the lock was released, false otherwise.
     bool unlock() {
     bool unlock() {
         return (sync_.unlock());
         return (sync_.unlock());
     }
     }

+ 7 - 1
src/lib/util/interprocess_sync_file.h

@@ -62,18 +62,24 @@ public:
 protected:
 protected:
     /// \brief Acquire the lock (blocks if something else has acquired a
     /// \brief Acquire the lock (blocks if something else has acquired a
     /// lock on the same task name)
     /// lock on the same task name)
+    ///
+    /// \return Returns true if the lock was acquired, false otherwise.
     bool lock();
     bool lock();
 
 
     /// \brief Try to acquire a lock (doesn't block)
     /// \brief Try to acquire a lock (doesn't block)
+    ///
+    /// \return Returns true if the lock was acquired, false otherwise.
     bool tryLock();
     bool tryLock();
 
 
     /// \brief Release the lock
     /// \brief Release the lock
+    ///
+    /// \return Returns true if the lock was released, false otherwise.
     bool unlock();
     bool unlock();
 
 
 private:
 private:
     bool do_lock(int cmd, short l_type);
     bool do_lock(int cmd, short l_type);
 
 
-    int fd_;
+    int fd_; ///< The descriptor for the open file
 };
 };
 
 
 } // namespace util
 } // namespace util