Update of /cvsroot/boost/boost/boost/interprocess/sync
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29744/sync
Modified Files:
file_lock.hpp
Log Message:
no message
Index: file_lock.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/sync/file_lock.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- file_lock.hpp 12 May 2007 12:51:20 -0000 1.5
+++ file_lock.hpp 23 Jun 2007 12:52:18 -0000 1.6
@@ -20,6 +20,7 @@
#include <boost/interprocess/exceptions.hpp>
#include <assert.h>
#include <boost/interprocess/detail/os_file_functions.hpp>
+#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
/*!\file
Describes a class that wraps file locking capabilities.
@@ -105,6 +106,118 @@
/// @cond
private:
file_handle_t m_file_hnd;
+
+ bool timed_acquire_file_lock
+ (file_handle_t hnd, bool &acquired, const boost::posix_time::ptime
&abs_time)
+ {
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+ using namespace boost::detail;
+
+ if(now >= abs_time) return false;
+
+ do{
+ if(!try_acquire_file_lock(hnd, acquired))
+ return false;
+
+ if(acquired)
+ return true;
+ else{
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ acquired = false;
+ return true;
+ }
+ // relinquish current time slice
+ winapi::sched_yield();
+ }
+ }while (true);
+ }
+
+ bool timed_acquire_file_lock_sharable
+ (file_handle_t hnd, bool &acquired, const boost::posix_time::ptime
&abs_time)
+ {
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+ using namespace boost::detail;
+
+ if(now >= abs_time) return false;
+
+ do{
+ if(!try_acquire_file_lock_sharable(hnd, acquired))
+ return false;
+
+ if(acquired)
+ return true;
+ else{
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ acquired = false;
+ return true;
+ }
+ // relinquish current time slice
+ winapi::sched_yield();
+ }
+ }while (true);
+ }
+
+ bool timed_acquire_file_lock
+ (file_handle_t hnd, bool &acquired, const boost::posix_time::ptime
&abs_time)
+ {
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+ using namespace boost::detail;
+
+ if(now >= abs_time) return false;
+
+ do{
+ if(!try_acquire_file_lock(hnd, acquired))
+ return false;
+
+ if(acquired)
+ return true;
+ else{
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ acquired = false;
+ return true;
+ }
+ // relinquish current time slice
+ sleep(0);
+ }
+ }while (true);
+ }
+
+ bool timed_acquire_file_lock_sharable
+ (file_handle_t hnd, bool &acquired, const boost::posix_time::ptime
&abs_time)
+ {
+ //Obtain current count and target time
+ boost::posix_time::ptime now = microsec_clock::universal_time();
+ using namespace boost::detail;
+
+ if(now >= abs_time) return false;
+
+ do{
+ if(!try_acquire_file_lock_sharable(hnd, acquired))
+ return false;
+
+ if(acquired)
+ return true;
+ else{
+ now = microsec_clock::universal_time();
+
+ if(now >= abs_time){
+ acquired = false;
+ return true;
+ }
+ // relinquish current time slice
+ ::sleep(0);
+ }
+ }while (true);
+ }
/// @endcond
};
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs