chore(JSON): add stringify unicode tests #4707 (#4720)

* chore(JSON): add stringify unicode tests #4707

* enh(Mutex): Error code for pthread_mutex_lock failure #4712
This commit is contained in:
Aleksandar Fabijanic
2024-10-14 06:48:45 -05:00
committed by GitHub
parent 8e958f685f
commit 71a085c1dc
8 changed files with 88 additions and 47 deletions

View File

@@ -20,8 +20,8 @@
#include "Poco/Foundation.h"
#include "Poco/Exception.h"
#include "Poco/Error.h"
#include <pthread.h>
#include <errno.h>
namespace Poco {
@@ -56,8 +56,9 @@ protected:
//
inline void MutexImpl::lockImpl()
{
if (pthread_mutex_lock(&_mutex))
throw SystemException("cannot lock mutex");
int rc;
if ((rc = pthread_mutex_lock(&_mutex)))
throw SystemException("cannot lock mutex", Error::getMessage(rc));
}
@@ -69,14 +70,15 @@ inline bool MutexImpl::tryLockImpl()
else if (rc == EBUSY)
return false;
else
throw SystemException("cannot lock mutex");
throw SystemException("cannot lock mutex", Error::getMessage(rc));
}
inline void MutexImpl::unlockImpl()
{
if (pthread_mutex_unlock(&_mutex))
throw SystemException("cannot unlock mutex");
int rc;
if ((rc = pthread_mutex_unlock(&_mutex)))
throw SystemException("cannot unlock mutex", Error::getMessage(rc));
}