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/Semaphore_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/Semaphore_VX.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/Semaphore_VX.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/contrib/libs/poco/Foundation/src/Semaphore_VX.cpp b/contrib/libs/poco/Foundation/src/Semaphore_VX.cpp index 498fa04c45..5bc63b530c 100644 --- a/contrib/libs/poco/Foundation/src/Semaphore_VX.cpp +++ b/contrib/libs/poco/Foundation/src/Semaphore_VX.cpp @@ -1,52 +1,52 @@ -// -// Semaphore_VX.cpp -// -// Library: Foundation -// Package: Threading -// Module: Semaphore -// -// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Semaphore_VX.h" -#include <sysLib.h> - - -namespace Poco { - - -SemaphoreImpl::SemaphoreImpl(int n, int max) -{ - poco_assert (n >= 0 && max > 0 && n <= max); - - _sem = semCCreate(SEM_Q_PRIORITY, n); - if (_sem == 0) - throw Poco::SystemException("cannot create semaphore"); -} - - -SemaphoreImpl::~SemaphoreImpl() -{ - semDelete(_sem); -} - - -void SemaphoreImpl::waitImpl() -{ - if (semTake(_sem, WAIT_FOREVER) != OK) - throw SystemException("cannot wait for semaphore"); -} - - -bool SemaphoreImpl::waitImpl(long milliseconds) -{ - int ticks = milliseconds*sysClkRateGet()/1000; - return semTake(_sem, ticks) == OK; -} - - -} // namespace Poco +// +// Semaphore_VX.cpp +// +// Library: Foundation +// Package: Threading +// Module: Semaphore +// +// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/Semaphore_VX.h" +#include <sysLib.h> + + +namespace Poco { + + +SemaphoreImpl::SemaphoreImpl(int n, int max) +{ + poco_assert (n >= 0 && max > 0 && n <= max); + + _sem = semCCreate(SEM_Q_PRIORITY, n); + if (_sem == 0) + throw Poco::SystemException("cannot create semaphore"); +} + + +SemaphoreImpl::~SemaphoreImpl() +{ + semDelete(_sem); +} + + +void SemaphoreImpl::waitImpl() +{ + if (semTake(_sem, WAIT_FOREVER) != OK) + throw SystemException("cannot wait for semaphore"); +} + + +bool SemaphoreImpl::waitImpl(long milliseconds) +{ + int ticks = milliseconds*sysClkRateGet()/1000; + return semTake(_sem, ticks) == OK; +} + + +} // namespace Poco |