Changeset 1378:df157df9164c


Ignore:
Timestamp:
10/20/09 22:55:08 (2 years ago)
Author:
niam
Branch:
default
Parents:
1376:0c27d6fe47b2 (diff), 1377:907b0a6f6889 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

branch merge

Location:
trunk
Files:
26 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/libdodo/pcSyncProtector.h

    r1373 r1378  
    22 *            pcSyncProtector.h 
    33 * 
    4  *  Sat Oct 20 2007 
     4 *  Mon Oct 22 2007 
    55 *  Copyright  2007  Ni@m 
    66 *  niam.niam@gmail.com 
     
    3636        namespace pc { 
    3737                namespace sync { 
    38                         class section; 
    39  
    4038                        /** 
    4139                         * @class protector 
    42                          * @brief provides thread/process safe behaviour 
    43                          * @note it locks in constructor and unlocks in destructor 
     40                         * @brief provides shared data management functionality 
    4441                         */ 
    4542                        class protector { 
     
    4744 
    4845                                /** 
    49                                  * contructor 
     46                                 * destructor 
    5047                                 */ 
    51                                 protector(section *parent); 
     48                                virtual ~protector() = 0; 
    5249 
    5350                                /** 
    54                                  * destructor 
     51                                 * lock 
     52                                 * @param timeout defines wait timeout for unlock in microseconds 
     53                                 * @note if timeout is 0 it will wait infinitely 
    5554                                 */ 
    56                                 virtual ~protector(); 
     55                                virtual void acquire(unsigned long timeout) = 0; 
    5756 
    58                           protected: 
    59  
    60                                 section *keeper; ///< lock 
     57                                /** 
     58                                 * unlock 
     59                                 */ 
     60                                virtual void release() = 0; 
    6161                        }; 
    6262                }; 
     
    6464}; 
    6565#endif 
     66 
  • trunk/src/pcSyncProtector.cc

    r1373 r1378  
    22 *            pcSyncProtector.cc 
    33 * 
    4  *  Sat Oct 20 2007 
     4 *  Sun Jul 22 2007 
    55 *  Copyright  2007  Ni@m 
    66 *  niam.niam@gmail.com 
     
    3232#include <libdodo/pcSyncProtector.h> 
    3333 
    34 #include <libdodo/pcSyncSection.h> 
    35 #include <libdodo/exceptionBasic.h> 
    36  
    3734using namespace dodo::pc::sync; 
    3835 
    39 protector::protector(section *keeper) : keeper(keeper) 
     36protector::~protector() 
    4037{ 
    41         if (keeper != NULL) 
    42                 keeper->acquire(); 
    4338} 
    4439 
    4540//------------------------------------------------------------------- 
    46  
    47 protector::~protector() 
    48 { 
    49         try { 
    50                 if (keeper != NULL) 
    51                         keeper->release(); 
    52         } catch (exception::basic &ex) { 
    53         } 
    54 } 
    55  
    56 //------------------------------------------------------------------- 
    57  
Note: See TracChangeset for help on using the changeset viewer.