diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/poco/Foundation/src/Event_VX.cpp | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/Event_VX.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/Event_VX.cpp | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/contrib/libs/poco/Foundation/src/Event_VX.cpp b/contrib/libs/poco/Foundation/src/Event_VX.cpp index 52732683ee..18f667156e 100644 --- a/contrib/libs/poco/Foundation/src/Event_VX.cpp +++ b/contrib/libs/poco/Foundation/src/Event_VX.cpp @@ -1,79 +1,79 @@ -// -// Event_POSIX.cpp -// -// Library: Foundation -// Package: Threading -// Module: Event -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Event_VX.h" -#include <sysLib.h> - - -namespace Poco { - - -EventImpl::EventImpl(bool autoReset): _auto(autoReset), _state(false) -{ - _sem = semCCreate(SEM_Q_PRIORITY, 0); - if (_sem == 0) - throw Poco::SystemException("cannot create event"); -} - - -EventImpl::~EventImpl() -{ - semDelete(_sem); -} - - -void EventImpl::setImpl() -{ - if (_auto) - { - if (semGive(_sem) != OK) - throw SystemException("cannot set event"); - } - else - { - _state = true; - if (semFlush(_sem) != OK) - throw SystemException("cannot set event"); - } -} - - -void EventImpl::resetImpl() -{ - _state = false; -} - - -void EventImpl::waitImpl() -{ - if (!_state) - { - if (semTake(_sem, WAIT_FOREVER) != OK) - throw SystemException("cannot wait for event"); - } -} - - -bool EventImpl::waitImpl(long milliseconds) -{ - if (!_state) - { - int ticks = milliseconds*sysClkRateGet()/1000; - return semTake(_sem, ticks) == OK; - } - else return true; -} - - -} // namespace Poco +// +// Event_POSIX.cpp +// +// Library: Foundation +// Package: Threading +// Module: Event +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/Event_VX.h" +#include <sysLib.h> + + +namespace Poco { + + +EventImpl::EventImpl(bool autoReset): _auto(autoReset), _state(false) +{ + _sem = semCCreate(SEM_Q_PRIORITY, 0); + if (_sem == 0) + throw Poco::SystemException("cannot create event"); +} + + +EventImpl::~EventImpl() +{ + semDelete(_sem); +} + + +void EventImpl::setImpl() +{ + if (_auto) + { + if (semGive(_sem) != OK) + throw SystemException("cannot set event"); + } + else + { + _state = true; + if (semFlush(_sem) != OK) + throw SystemException("cannot set event"); + } +} + + +void EventImpl::resetImpl() +{ + _state = false; +} + + +void EventImpl::waitImpl() +{ + if (!_state) + { + if (semTake(_sem, WAIT_FOREVER) != OK) + throw SystemException("cannot wait for event"); + } +} + + +bool EventImpl::waitImpl(long milliseconds) +{ + if (!_state) + { + int ticks = milliseconds*sysClkRateGet()/1000; + return semTake(_sem, ticks) == OK; + } + else return true; +} + + +} // namespace Poco |