added qse_mtx_trylock() and QSE::Mutex::trylock()
This commit is contained in:
@ -421,6 +421,9 @@
|
||||
/* pthreads has pthread_mutex_timedlock() */
|
||||
#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
||||
|
||||
/* pthreads has pthread_mutex_trylock() */
|
||||
#undef HAVE_PTHREAD_MUTEX_TRYLOCK
|
||||
|
||||
/* Have PTHREAD_PRIO_INHERIT. */
|
||||
#undef HAVE_PTHREAD_PRIO_INHERIT
|
||||
|
||||
|
@ -47,12 +47,6 @@ public:
|
||||
qse_mtx_fini (&this->mtx);
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool tryock() QSE_CPP_NOEXCEPT
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void lock () QSE_CPP_NOEXCEPT
|
||||
{
|
||||
qse_mtx_lock (&this->mtx, QSE_NULL);
|
||||
@ -63,6 +57,11 @@ public:
|
||||
qse_mtx_unlock (&this->mtx);
|
||||
}
|
||||
|
||||
bool trylock () QSE_CPP_NOEXCEPT
|
||||
{
|
||||
return qse_mtx_trylock (&this->mtx) >= 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
qse_mtx_t mtx;
|
||||
};
|
||||
|
@ -127,6 +127,9 @@ QSE_EXPORT int qse_mtx_unlock (
|
||||
qse_mtx_t* mtx
|
||||
);
|
||||
|
||||
QSE_EXPORT int qse_mtx_trylock (
|
||||
qse_mtx_t* mtx
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ protected:
|
||||
int put_char (qse_char_t ch) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
return this->put_mchar(ch)
|
||||
return this->put_mchar(ch);
|
||||
#else
|
||||
return this->put_wchar(ch);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user