Files
wlan-cloud-lib-poco/Foundation/include/Poco/Event_POSIX.h
Aleksandar Fabijanic be19dc4a2f 1.12.2 release merge (#3695)
* chore: 1.12.2 versions and notes

* chore: spelling fix

* fix(): Linking Crypto-testrunner fails #3688

* fix(Event): POSIX Event state need not be atomic #3699

* fix(OpenSSLInitializer): SIGABRT in OSSL_PROVIDER_unload with static OpenSSL3 #3698

* #3700: Release script must include build_vs170.cmd

* fix(mingw): lowercase winsock2 and iphlpapi to allow cross compile #3711

* fix(PollSet): wakeup fd is never read #3708

* fix(PollSet): wakeup fd is never read (windows portion and some other optimizations) #3708

* fix(PollSet): wakeup fd is never read #3708

* fix(PollSet): Compiling with clang_cl_x64_x64 on Visual Studio 2022 failed #3716

* fix(SpinlockMutex): VS2022 compilation issues #3693

* Only support extracting JSON fields when the SDK supports it (#3717)

* Added preprocessor defined to detect support for JSON

* Only support extracting JSON fields when the SDK supports it

* Fix version comparison

* fix(MSVC): PocoNet Project File does not support Visual Studio 2022 #3719

* Update max MSVC version information (#3720)

add visual studio 2022 support

* Added missing Crypto Header to ProGen source (#3722)

* fix(Crypto): fails to build with Visual Studio projects #3721

* Crypto: Progen again to add new files and bring back ARM64 configuration (#3724)

* Progen Crypto to re-add ARM64

* Add new files

* Add how to install using Conan section on README (#3727)

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* fix(Platform): LoongArch support #3460

* fix(format): Poco::format and C++20 #3733

* fix: g++ C++20 warnings #3734

* core(CI): add c++20

* fix(CI): skip MySQL tests for c++20

* release 1.12.2

Co-authored-by: Günter Obiltschnig <guenter.obiltschnig@appinf.com>
Co-authored-by: Hernan Martinez <hernan.c.martinez@gmail.com>
Co-authored-by: Byungjun Lee <40881444+OneTop4458@users.noreply.github.com>
Co-authored-by: Hernan Martinez <hmartinez@malwarebytes.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
2022-08-07 05:10:18 -05:00

79 lines
1.3 KiB
C++

//
// Event_POSIX.h
//
// Library: Foundation
// Package: Threading
// Module: Event
//
// Definition of the EventImpl class for POSIX Threads.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Event_POSIX_INCLUDED
#define Foundation_Event_POSIX_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Exception.h"
#include <pthread.h>
#include <errno.h>
#include <atomic>
namespace Poco {
class Foundation_API EventImpl
{
protected:
EventImpl(bool autoReset);
~EventImpl();
void setImpl();
void waitImpl();
bool waitImpl(long milliseconds);
void resetImpl();
private:
bool _auto;
bool _state;
pthread_mutex_t _mutex;
pthread_cond_t _cond;
};
//
// inlines
//
inline void EventImpl::setImpl()
{
if (pthread_mutex_lock(&_mutex))
throw SystemException("cannot signal event (lock)");
_state = true;
if (pthread_cond_broadcast(&_cond))
{
pthread_mutex_unlock(&_mutex);
throw SystemException("cannot signal event");
}
pthread_mutex_unlock(&_mutex);
}
inline void EventImpl::resetImpl()
{
if (pthread_mutex_lock(&_mutex))
throw SystemException("cannot reset event");
_state = false;
pthread_mutex_unlock(&_mutex);
}
} // namespace Poco
#endif // Foundation_Event_POSIX_INCLUDED