version 1.47, 2006/01/30 16:16:46
|
version 1.47.12.1, 2006/06/29 17:33:12
|
|
|
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Message.h> | #include <Pegasus/Common/Message.h> |
#include <Pegasus/Common/internal_dq.h> |
|
#include <Pegasus/Common/IPC.h> | #include <Pegasus/Common/IPC.h> |
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
|
#include <Pegasus/Common/Linkable.h> |
|
#include <Pegasus/Common/List.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
class Cimom; | class Cimom; |
class Thread; | class Thread; |
| |
class PEGASUS_COMMON_LINKAGE AsyncOpNode |
class PEGASUS_COMMON_LINKAGE AsyncOpNode : public Linkable |
{ | { |
| |
// public: | // public: |
|
|
private: | private: |
Semaphore _client_sem; | Semaphore _client_sem; |
Mutex _mut; | Mutex _mut; |
unlocked_dq<Message> _request; |
List<Message,NullLock> _request; |
unlocked_dq<Message> _response; |
List<Message,NullLock> _response; |
| |
Uint32 _state; | Uint32 _state; |
Uint32 _flags; | Uint32 _flags; |
|
|
struct timeval _timeout_interval; | struct timeval _timeout_interval; |
| |
AsyncOpNode *_parent; | AsyncOpNode *_parent; |
unlocked_dq<AsyncOpNode> _children; |
List<AsyncOpNode,NullLock> _children; |
| |
void _reset(unlocked_dq<AsyncOpNode> *dst_q); |
void _reset(List<AsyncOpNode,NullLock> *dst_q); |
| |
// the lifetime member is for cache management by the cimom | // the lifetime member is for cache management by the cimom |
void _set_lifetime(struct timeval *lifetime) ; | void _set_lifetime(struct timeval *lifetime) ; |
|
|
{ | { |
AutoMutex autoMut(_mut); | AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
if( false == _request.exists(reinterpret_cast<void *>(const_cast<Message *>(request))) ) |
|
_request.insert_last( const_cast<Message *>(request) ) ; |
|
| |
// _request = const_cast<Message *>(request); |
if (!_request.contains(request)) |
|
_request.insert_back((Message*)request); |
} | } |
| |
inline Message * AsyncOpNode::get_request(void) | inline Message * AsyncOpNode::get_request(void) |
|
|
Message *ret; | Message *ret; |
AutoMutex autoMut(_mut); | AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
ret = _request.remove_first() ; |
ret = _request.remove_front() ; |
| |
return ret; | return ret; |
} | } |
|
|
{ | { |
AutoMutex autoMut(_mut); | AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
if (false == _response.exists(reinterpret_cast<void *>(const_cast<Message *>(response)))) |
|
_response.insert_last( const_cast<Message *>(response) ); |
if (!_response.contains(response)) |
|
_response.insert_back((Message*)response); |
} | } |
| |
inline Message * AsyncOpNode::get_response(void) | inline Message * AsyncOpNode::get_response(void) |
|
|
| |
AutoMutex autoMut(_mut); | AutoMutex autoMut(_mut); |
// gettimeofday(&_updated, NULL); | // gettimeofday(&_updated, NULL); |
ret = _response.remove_first(); |
ret = _response.remove_front(); |
// ret = _response; | // ret = _response; |
| |
return ret; | return ret; |
|
|
| |
inline Uint32 AsyncOpNode::_is_parent(void) | inline Uint32 AsyncOpNode::_is_parent(void) |
{ | { |
return _children.count(); |
return _children.size(); |
} | } |
| |
inline Boolean AsyncOpNode::_is_my_child(const AsyncOpNode & caller) const | inline Boolean AsyncOpNode::_is_my_child(const AsyncOpNode & caller) const |
|
|
if(true == child->_is_child()) | if(true == child->_is_child()) |
throw Permission(pegasus_thread_self()); | throw Permission(pegasus_thread_self()); |
child->_parent = this; | child->_parent = this; |
_children.insert_last(child); |
_children.insert_back(child); |
} | } |
| |
inline void AsyncOpNode::_disown_child(AsyncOpNode *child) | inline void AsyncOpNode::_disown_child(AsyncOpNode *child) |