_IpcClient::_IpcClient(void)
: __pReverseSource(null)
, __fdCount(0)
+ , __timeout(-1)
, __pFdLock(null)
, __pListener(null)
{
while (true)
{
- ret = poll(&pfd, 1, -1);
+ ret = poll(&pfd, 1, __timeout);
if (ret < 0)
{
if (errno == EINTR)
ReleaseFd(fd);
return E_SYSTEM;
}
+ else if (ret == 0)
+ {
+ SysLogException(NID_IO, E_TIMEOUT, "[E_TIMEOUT] Timeout.");
+
+ ReleaseFd(fd);
+ return E_TIMEOUT;
+ }
if (pfd.revents & POLLRDHUP)
{
return r;
}
+void
+_IpcClient::SetTimeout(int timeout)
+{
+ __timeout = timeout;
+}
+
+int
+_IpcClient::GetTimeout(void) const
+{
+ return __timeout;
+}
+
} } //Tizen::Io
* @exception E_SUCCESS The method was successful.
* @exception E_INVALID_STATE The instance is in an invalid state.
* @exception E_OUT_OF_MEMORY Insufficient memory.
+ * @exception E_TIMEOUT The operation can not be completed within the specified time period.
* @exception E_SYSTEM A system error occurred.
*
*/
result SendRequest(IPC::Message* pMessage);
+
+ /**
+ * Sets the timeout value which is used to send a synchronous message to the server.
+ *
+ * @param[in] timeout The time limit for synchronous messages, in milliseconds.
+ * @c infinite timeout if @c timeout value is a negative.
+ */
+ void SetTimeout(int timeout);
+
+ /**
+ * Gets the timeout value.
+ *
+ * @return The name of the IPC server.
+ */
+ int GetTimeout() const;
+
private:
_IpcClient(const _IpcClient& value);
std::vector <int> __fds;
int __fdCount;
+ int __timeout;
Tizen::Base::Runtime::Mutex* __pFdLock;
Tizen::Base::String __name;
_IIpcClientEventListener* __pListener;