Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

File_Lock.inl

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: File_Lock.inl,v 1.1.1.1 2001/12/04 14:33:00 chad Exp $
00003 
00004 ACE_INLINE int
00005 ACE_File_Lock::acquire_read (short whence, off_t start, off_t len)
00006 {
00007 // ACE_TRACE ("ACE_File_Lock::acquire_read");
00008   return ACE_OS::flock_rdlock (&this->lock_, whence, start, len);
00009 }
00010 
00011 ACE_INLINE int
00012 ACE_File_Lock::tryacquire_read (short whence, off_t start, off_t len)
00013 {
00014 // ACE_TRACE ("ACE_File_Lock::tryacquire_read");
00015   return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len);
00016 }
00017 
00018 ACE_INLINE int
00019 ACE_File_Lock::tryacquire_write (short whence, off_t start, off_t len)
00020 {
00021 // ACE_TRACE ("ACE_File_Lock::tryacquire_write");
00022   return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len);
00023 }
00024 
00025 ACE_INLINE int
00026 ACE_File_Lock::tryacquire_write_upgrade (short whence, off_t start, off_t len)
00027 {
00028 // ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade");
00029   return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len);
00030 }
00031 
00032 ACE_INLINE int
00033 ACE_File_Lock::tryacquire (short whence, off_t start, off_t len)
00034 {
00035 // ACE_TRACE ("ACE_File_Lock::tryacquire");
00036   return this->tryacquire_write (whence, start, len);
00037 }
00038 
00039 ACE_INLINE int
00040 ACE_File_Lock::acquire_write (short whence, off_t start, off_t len)
00041 {
00042 // ACE_TRACE ("ACE_File_Lock::acquire_write");
00043   return ACE_OS::flock_wrlock (&this->lock_, whence, start, len);
00044 }
00045 
00046 ACE_INLINE int
00047 ACE_File_Lock::acquire (short whence, off_t start, off_t len)
00048 {
00049 // ACE_TRACE ("ACE_File_Lock::acquire");
00050   return this->acquire_write (whence, start, len);
00051 }
00052 
00053 ACE_INLINE int
00054 ACE_File_Lock::release (short whence, off_t start, off_t len)
00055 {
00056 // ACE_TRACE ("ACE_File_Lock::release");
00057   return ACE_OS::flock_unlock (&this->lock_, whence, start, len);
00058 }
00059 
00060 ACE_INLINE int
00061 ACE_File_Lock::remove (int unlink_file)
00062 {
00063 // ACE_TRACE ("ACE_File_Lock::remove");
00064 
00065   int result = 0;
00066 
00067   if (this->removed_ == 0)
00068     {
00069       this->removed_ = 1;
00070       result = ACE_OS::flock_destroy (&this->lock_,
00071                                       unlink_file);
00072     }
00073   return result;
00074 }
00075 
00076 ACE_INLINE ACE_HANDLE
00077 ACE_File_Lock::get_handle (void) const
00078 {
00079 // ACE_TRACE ("ACE_File_Lock::get_handle");
00080   return this->lock_.handle_;
00081 }
00082 
00083 ACE_INLINE void
00084 ACE_File_Lock::set_handle (ACE_HANDLE h)
00085 {
00086 // ACE_TRACE ("ACE_File_Lock::set_handle");
00087   this->lock_.handle_ = h;
00088   this->removed_ = 0;
00089 }

Generated on Mon Jun 16 11:19:42 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002