Zen API
 All Classes Files Functions Variables Typedefs Macros Groups Pages
kLock.h
Go to the documentation of this file.
1 /**
2  * @file kLock.h
3  * @brief Declares the kLock class.
4  *
5  * @internal
6  * Copyright (C) 2005-2014 by LMI Technologies Inc.
7  * Licensed under the MIT License.
8  * Redistributed files must retain the above copyright notice.
9  */
10 #ifndef K_API_LOCK_H
11 #define K_API_LOCK_H
12 
13 #include <kApi/kApiDef.h>
14 
15 kBeginHeader()
16 
17 /**
18  * @class kLock
19  * @extends kObject
20  * @ingroup kApi-Threads
21  * @brief Represents a recursive mutual exclusion lock.
22  */
23 
24 /**
25  * Constructs a lock object.
26  *
27  * @public @memberof kLock
28  * @param lock Destination for the constructed object handle.
29  * @param allocator Memory allocator (or kNULL for default).
30  * @return Operation status.
31  */
32 kFx(kStatus) kLock_Construct(kLock* lock, kAlloc allocator);
33 
34 /**
35  * Blocks until exclusive ownership of the lock is acquired.
36  *
37  * kLock ownership is recursive - the lock is relinquished when the number of calls
38  * to kLock_Exit equals the number of calls to kLock_Enter.
39  *
40  * @public @memberof kLock
41  * @param lock Lock object.
42  * @return Operation status.
43  */
44 kFx(kStatus) kLock_Enter(kLock lock);
45 
46 /**
47  * Relinquishes ownership of the lock.
48  *
49  * kLock ownership is recursive - the lock is relinquished when the number of calls
50  * to kLock_Exit equals the number of calls to kLock_Enter.
51  *
52  * @public @memberof kLock
53  * @param lock Lock object.
54  * @return Operation status.
55  */
56 kFx(kStatus) kLock_Exit(kLock lock);
57 
58 kEndHeader()
59 
60 #include <kApi/Threads/kLock.x.h>
61 
62 #endif
Abstract base class for memory allocator types.
kStatus kLock_Enter(kLock lock)
Blocks until exclusive ownership of the lock is acquired.
Represents a recursive mutual exclusion lock.
kStatus kLock_Construct(kLock *lock, kAlloc allocator)
Constructs a lock object.
Essential API declarations.
Represents an enumeration of error codes.
kStatus kLock_Exit(kLock lock)
Relinquishes ownership of the lock.