#include <thread.h>
Public Member Functions | |
stack (mempager *pager=NULL, size_t number=0) | |
Create a stack that uses a memory pager for internally managed member objects for a specified maximum number of object pointers. | |
~stack () | |
Destroy queue. | |
bool | remove (Object *object) |
Remove a specific object pointer for the queue. | |
bool | push (Object *object, timeout_t timeout=0) |
Push an object into the stack by it's pointer. | |
Object * | pull (timeout_t timeout=0) |
Get and remove last object pushed on the stack. | |
size_t | getCount (void) |
Get number of object points currently in the stack. | |
Static Public Member Functions | |
static bool | remove (stack &stack, Object *object) |
Convenience function to remove an object from the stacl. | |
static bool | push (stack &stack, Object *object, timeout_t timeout=0) |
Convenience function to push object into the stack. | |
static Object * | pull (stack &stack, timeout_t timeout=0) |
Convenience function pull last object from the stack. | |
static size_t | count (stack &stack) |
Convenience function to get count of objects in the stack. | |
Protected Attributes | |
size_t | limit |
Friends | |
class | member |
This Thread-safe access is managed through a conditional. This differs from the queue in lifo mode because delinking the last object is immediate, and because it has much less overhead. A pool of self-managed member objects are used to operate the stack.
Definition at line 1785 of file thread.h.
ucc::stack::stack | ( | mempager * | pager = NULL , |
|
size_t | number = 0 | |||
) |
static size_t ucc::stack::count | ( | stack & | stack | ) | [inline, static] |
size_t ucc::stack::getCount | ( | void | ) |
Get and remove last object pushed on the stack.
This can wait for a specified timeout of the stack is empty. The object is still retained and must be released or deleted by the receiving function.
timeout | to wait if empty in milliseconds. |
Reimplemented in ucc::stackof< T, P >.
Push an object into the stack by it's pointer.
This can wait for a specified timeout if the stack is full, for example, for another thread to remove an object pointer. This also retains the object.
object | to push. | |
timeout | to wait if stack is full in milliseconds. |
bool ucc::stack::remove | ( | Object * | object | ) |