Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / File_Lock.cpp
blob64f691383079adf49d9b90929f4ba35c48a58efd
1 #include "ace/File_Lock.h"
2 #include "ace/Log_Category.h"
3 #if defined (ACE_HAS_ALLOC_HOOKS)
4 # include "ace/Malloc_Base.h"
5 #endif /* ACE_HAS_ALLOC_HOOKS */
7 #if !defined (__ACE_INLINE__)
8 #include "ace/File_Lock.inl"
9 #endif /* __ACE_INLINE__ */
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock)
15 void
16 ACE_File_Lock::dump () const
18 #if defined (ACE_HAS_DUMP)
19 // ACE_TRACE ("ACE_File_Lock::dump");
21 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
22 this->lock_.dump ();
23 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
24 #endif /* ACE_HAS_DUMP */
27 ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h,
28 bool unlink_in_destructor)
29 : removed_ (false),
30 unlink_in_destructor_ (unlink_in_destructor)
32 // ACE_TRACE ("ACE_File_Lock::ACE_File_Lock");
33 if (ACE_OS::flock_init (&this->lock_) == -1)
34 ACELIB_ERROR ((LM_ERROR,
35 ACE_TEXT ("%p\n"),
36 ACE_TEXT ("ACE_File_Lock::ACE_File_Lock")));
37 this->set_handle (h);
40 ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name,
41 int flags,
42 mode_t perms,
43 bool unlink_in_destructor)
44 : unlink_in_destructor_ (unlink_in_destructor)
46 // ACE_TRACE ("ACE_File_Lock::ACE_File_Lock");
48 if (this->open (name, flags, perms) == -1)
49 ACELIB_ERROR ((LM_ERROR,
50 ACE_TEXT ("%p %s\n"),
51 ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"),
52 name));
55 int
56 ACE_File_Lock::open (const ACE_TCHAR *name,
57 int flags,
58 mode_t perms)
60 // ACE_TRACE ("ACE_File_Lock::open");
61 this->removed_ = false;
62 return ACE_OS::flock_init (&this->lock_, flags, name, perms);
65 ACE_File_Lock::~ACE_File_Lock ()
67 // ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock");
68 this->remove (this->unlink_in_destructor_);
71 ACE_END_VERSIONED_NAMESPACE_DECL