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__ */
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
15 ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock
)
18 ACE_File_Lock::dump (void) const
20 #if defined (ACE_HAS_DUMP)
21 // ACE_TRACE ("ACE_File_Lock::dump");
23 ACELIB_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
25 ACELIB_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
26 #endif /* ACE_HAS_DUMP */
29 ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h
,
30 bool unlink_in_destructor
)
32 unlink_in_destructor_ (unlink_in_destructor
)
34 // ACE_TRACE ("ACE_File_Lock::ACE_File_Lock");
35 if (ACE_OS::flock_init (&this->lock_
) == -1)
36 ACELIB_ERROR ((LM_ERROR
,
38 ACE_TEXT ("ACE_File_Lock::ACE_File_Lock")));
42 ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR
*name
,
45 bool unlink_in_destructor
)
46 : unlink_in_destructor_ (unlink_in_destructor
)
48 // ACE_TRACE ("ACE_File_Lock::ACE_File_Lock");
50 if (this->open (name
, flags
, perms
) == -1)
51 ACELIB_ERROR ((LM_ERROR
,
53 ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"),
58 ACE_File_Lock::open (const ACE_TCHAR
*name
,
62 // ACE_TRACE ("ACE_File_Lock::open");
63 this->removed_
= false;
64 return ACE_OS::flock_init (&this->lock_
, flags
, name
, perms
);
67 ACE_File_Lock::~ACE_File_Lock (void)
69 // ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock");
70 this->remove (this->unlink_in_destructor_
);
73 ACE_END_VERSIONED_NAMESPACE_DECL