version 1.40, 2004/07/19 06:06:56
|
version 1.41, 2004/08/12 10:47:43
|
|
|
// Author: Mike Day (mdday@us.ibm.com) | // Author: Mike Day (mdday@us.ibm.com) |
// | // |
// Modified By: Amit K Arora, IBM (amita@in.ibm.com) for Bug#1188 | // Modified By: Amit K Arora, IBM (amita@in.ibm.com) for Bug#1188 |
|
// Alagaraja Ramasubramanian (alags_raj@in.ibm.com) for Bug#1090 |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
{ | { |
if(buffer != 0) | if(buffer != 0) |
{ | { |
_mut.lock( pegasus_thread_self() ); |
AutoMutex autoMut(_mut); |
buffer->tv_sec = _timeout_interval.tv_sec; | buffer->tv_sec = _timeout_interval.tv_sec; |
buffer->tv_usec = _timeout_interval.tv_usec; | buffer->tv_usec = _timeout_interval.tv_usec; |
_mut.unlock(); |
} // mutex unlocks here |
} |
|
return; | return; |
} | } |
| |
|
|
{ | { |
if(interval != 0) | if(interval != 0) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_timeout_interval.tv_sec = interval->tv_sec; | _timeout_interval.tv_sec = interval->tv_sec; |
_timeout_interval.tv_usec = interval->tv_usec; | _timeout_interval.tv_usec = interval->tv_usec; |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_mut.unlock(); |
} // mutex unlocks here |
} |
|
} | } |
| |
| |
|
|
struct timeval now; | struct timeval now; |
gettimeofday(&now, NULL); | gettimeofday(&now, NULL); |
Boolean ret = false; | Boolean ret = false; |
_mut.lock(pegasus_thread_self()); |
|
|
AutoMutex autoMut(_mut); |
if((_updated.tv_sec + _timeout_interval.tv_sec ) < now.tv_sec) | if((_updated.tv_sec + _timeout_interval.tv_sec ) < now.tv_sec) |
if((_updated.tv_usec + _timeout_interval.tv_usec ) < now.tv_usec) | if((_updated.tv_usec + _timeout_interval.tv_usec ) < now.tv_usec) |
ret = true; | ret = true; |
_mut.unlock(); |
|
return ret; | return ret; |
} | } |
| |
|
|
| |
inline void AsyncOpNode::put_request(const Message *request) | inline void AsyncOpNode::put_request(const Message *request) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
if( false == _request.exists(reinterpret_cast<void *>(const_cast<Message *>(request))) ) | if( false == _request.exists(reinterpret_cast<void *>(const_cast<Message *>(request))) ) |
_request.insert_last( const_cast<Message *>(request) ) ; | _request.insert_last( const_cast<Message *>(request) ) ; |
| |
// _request = const_cast<Message *>(request); | // _request = const_cast<Message *>(request); |
| |
_mut.unlock(); |
|
} | } |
| |
inline Message * AsyncOpNode::get_request(void) | inline Message * AsyncOpNode::get_request(void) |
{ | { |
Message *ret; | Message *ret; |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
ret = _request.remove_first() ; | ret = _request.remove_first() ; |
_mut.unlock(); |
|
return ret; | return ret; |
} | } |
| |
inline void AsyncOpNode::put_response(const Message *response) | inline void AsyncOpNode::put_response(const Message *response) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
if (false == _response.exists(reinterpret_cast<void *>(const_cast<Message *>(response)))) | if (false == _response.exists(reinterpret_cast<void *>(const_cast<Message *>(response)))) |
_response.insert_last( const_cast<Message *>(response) ); | _response.insert_last( const_cast<Message *>(response) ); |
_mut.unlock(); |
|
} | } |
| |
inline Message * AsyncOpNode::get_response(void) | inline Message * AsyncOpNode::get_response(void) |
{ | { |
Message *ret; | Message *ret; |
| |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
// gettimeofday(&_updated, NULL); | // gettimeofday(&_updated, NULL); |
ret = _response.remove_first(); | ret = _response.remove_first(); |
// ret = _response; | // ret = _response; |
| |
_mut.unlock(); |
|
return ret; | return ret; |
} | } |
| |
inline Uint32 AsyncOpNode::read_state(void) | inline Uint32 AsyncOpNode::read_state(void) |
{ | { |
_mut.lock(pegasus_thread_self()); |
|
|
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
Uint32 ret = _state; | Uint32 ret = _state; |
_mut.unlock(); |
|
return ret; | return ret; |
| |
} | } |
| |
inline void AsyncOpNode::write_state(Uint32 state) | inline void AsyncOpNode::write_state(Uint32 state) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_state = state; | _state = state; |
_mut.unlock(); |
|
} | } |
| |
inline Uint32 AsyncOpNode::read_flags(void) | inline Uint32 AsyncOpNode::read_flags(void) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
Uint32 ret = _flags; | Uint32 ret = _flags; |
_mut.unlock(); |
|
return ret; | return ret; |
} | } |
| |
inline void AsyncOpNode::write_flags(Uint32 flags) | inline void AsyncOpNode::write_flags(Uint32 flags) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_flags = flags; | _flags = flags; |
_mut.unlock(); |
|
} | } |
| |
| |
|
|
inline void AsyncOpNode::udpate(void) | inline void AsyncOpNode::udpate(void) |
throw(IPCException) | throw(IPCException) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_mut.unlock(); |
|
return; | return; |
} | } |
| |
inline void AsyncOpNode::deliver(const Uint32 count) | inline void AsyncOpNode::deliver(const Uint32 count) |
throw(IPCException) | throw(IPCException) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_completed_ops = count; | _completed_ops = count; |
_state |= ASYNC_OPSTATE_DELIVER; | _state |= ASYNC_OPSTATE_DELIVER; |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_mut.unlock(); |
|
return; | return; |
} | } |
| |
inline void AsyncOpNode::reserve(const Uint32 size) | inline void AsyncOpNode::reserve(const Uint32 size) |
throw(IPCException) | throw(IPCException) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_total_ops = size; | _total_ops = size; |
_state |= ASYNC_OPSTATE_RESERVE; | _state |= ASYNC_OPSTATE_RESERVE; |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_mut.unlock(); |
|
return; | return; |
} | } |
| |
inline void AsyncOpNode::processing(void) | inline void AsyncOpNode::processing(void) |
throw(IPCException) | throw(IPCException) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_state |= ASYNC_OPSTATE_PROCESSING; | _state |= ASYNC_OPSTATE_PROCESSING; |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_mut.unlock(); |
|
return; | return; |
} | } |
| |
|
|
inline void AsyncOpNode::processing(OperationContext *con) | inline void AsyncOpNode::processing(OperationContext *con) |
throw(IPCException) | throw(IPCException) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_state |= ASYNC_OPSTATE_PROCESSING; | _state |= ASYNC_OPSTATE_PROCESSING; |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
| |
|
|
c = con->remove_context(); | c = con->remove_context(); |
} | } |
*/ | */ |
_mut.unlock(); |
|
return; | return; |
} | } |
| |
inline void AsyncOpNode::complete(void) | inline void AsyncOpNode::complete(void) |
throw(IPCException) | throw(IPCException) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_state |= ASYNC_OPSTATE_COMPLETE; | _state |= ASYNC_OPSTATE_COMPLETE; |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
_mut.unlock(); |
|
| |
return; | return; |
} | } |
|
|
inline void AsyncOpNode::complete(OperationContext *con) | inline void AsyncOpNode::complete(OperationContext *con) |
throw(IPCException) | throw(IPCException) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_state |= ASYNC_OPSTATE_COMPLETE; | _state |= ASYNC_OPSTATE_COMPLETE; |
gettimeofday(&_updated, NULL); | gettimeofday(&_updated, NULL); |
/* | /* |
|
|
c = con->remove_context(); | c = con->remove_context(); |
} | } |
*/ | */ |
_mut.unlock(); |
|
} | } |
| |
inline void AsyncOpNode::wait(void) | inline void AsyncOpNode::wait(void) |
|
|
| |
inline void AsyncOpNode::release(void) | inline void AsyncOpNode::release(void) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_state |= ASYNC_OPSTATE_RELEASED; | _state |= ASYNC_OPSTATE_RELEASED; |
_mut.unlock(); |
|
} | } |
| |
inline void AsyncOpNode::_set_lifetime(struct timeval *lifetime) | inline void AsyncOpNode::_set_lifetime(struct timeval *lifetime) |
{ | { |
_mut.lock(pegasus_thread_self()); |
AutoMutex autoMut(_mut); |
_lifetime.tv_sec = lifetime->tv_sec; | _lifetime.tv_sec = lifetime->tv_sec; |
_lifetime.tv_usec = lifetime->tv_usec; | _lifetime.tv_usec = lifetime->tv_usec; |
_mut.unlock(); |
|
} | } |
| |
inline Boolean AsyncOpNode::_check_lifetime(void) | inline Boolean AsyncOpNode::_check_lifetime(void) |