g_cond_wait(gcond, gmutex);
}
+tpl_result_t
+tpl_cond_timed_wait(tpl_gcond *gcond, tpl_gmutex *gmutex,
+ int64_t timeout_ms)
+{
+ gint64 end_time = g_get_monotonic_time() +
+ (timeout_ms * G_TIME_SPAN_MILLISECOND);
+ if (!g_cond_wait_until(gcond, gmutex, end_time))
+ return TPL_ERROR_TIME_OUT;
+
+ return TPL_ERROR_NONE;
+}
+
void
tpl_gcond_signal(tpl_gcond *gcond)
{
/**
* wrapping g_cond_init()
*
- * @param gmutex Pointer to tpl_gcond.
+ * @param gcond Pointer to tpl_gcond.
*/
void
tpl_gcond_init(tpl_gcond *gcond);
/**
* wrapping g_cond_clear()
*
- * @param gmutex Pointer to tpl_gcond.
+ * @param gcond Pointer to tpl_gcond.
*/
void
tpl_gcond_clear(tpl_gcond *gcond);
/**
* wrapping g_cond_wait()
*
- * @param gmutex Pointer to tpl_gcond.
+ * @param gcond Pointer to tpl_gcond.
+ * @param gmutex Pointer to tpl_gmutex
*/
void
tpl_gcond_wait(tpl_gcond *gcond, tpl_gmutex *gmutex);
/**
+ * wrapping g_cond_wait_until()
+ *
+ * @param gcond Pointer to tpl_gcond.
+ * @param gmutex Pointer to tpl_gmutex.
+ * @param timeout_ms int64_t time(ms) to wait.
+ *
+ * @return tpl_result_t TPL_ERROR_NONE or TPL_ERROR_TIME_OUT
+ */
+tpl_result_t
+tpl_cond_timed_wait(tpl_gcond *gcond, tpl_gmutex *gmutex, int64_t timeout_ms);
+
+/**
* wrapping g_cond_signal()
*
* @param gmutex Pointer to tpl_gcond.