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
)
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));
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
)
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
,
36 ACE_TEXT ("ACE_File_Lock::ACE_File_Lock")));
40 ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR
*name
,
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
,
51 ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"),
56 ACE_File_Lock::open (const ACE_TCHAR
*name
,
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