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/NamedEvent_WIN32.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/NamedEvent_WIN32.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/NamedEvent_WIN32.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/contrib/libs/poco/Foundation/src/NamedEvent_WIN32.cpp b/contrib/libs/poco/Foundation/src/NamedEvent_WIN32.cpp index 0453f62995..0aee72c5fb 100644 --- a/contrib/libs/poco/Foundation/src/NamedEvent_WIN32.cpp +++ b/contrib/libs/poco/Foundation/src/NamedEvent_WIN32.cpp @@ -1,61 +1,61 @@ -// -// NamedEvent_WIN32.cpp -// -// Library: Foundation -// Package: Processes -// Module: NamedEvent -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/NamedEvent_WIN32.h" -#include "Poco/Error.h" -#include "Poco/Exception.h" -#include "Poco/Format.h" - - -namespace Poco { - - -NamedEventImpl::NamedEventImpl(const std::string& name): - _name(name) -{ - _event = CreateEventA(NULL, FALSE, FALSE, _name.c_str()); - if (!_event) - { - DWORD dwRetVal = GetLastError(); - throw SystemException(format("cannot create named event %s [Error %d: %s]", _name, (int)dwRetVal, Error::getMessage(dwRetVal))); - } -} - - -NamedEventImpl::~NamedEventImpl() -{ - CloseHandle(_event); -} - - -void NamedEventImpl::setImpl() -{ - if (!SetEvent(_event)) - throw SystemException("cannot signal named event", _name); -} - - -void NamedEventImpl::waitImpl() -{ - switch (WaitForSingleObject(_event, INFINITE)) - { - case WAIT_OBJECT_0: - return; - default: - throw SystemException("wait for named event failed", _name); - } -} - - -} // namespace Poco +// +// NamedEvent_WIN32.cpp +// +// Library: Foundation +// Package: Processes +// Module: NamedEvent +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/NamedEvent_WIN32.h" +#include "Poco/Error.h" +#include "Poco/Exception.h" +#include "Poco/Format.h" + + +namespace Poco { + + +NamedEventImpl::NamedEventImpl(const std::string& name): + _name(name) +{ + _event = CreateEventA(NULL, FALSE, FALSE, _name.c_str()); + if (!_event) + { + DWORD dwRetVal = GetLastError(); + throw SystemException(format("cannot create named event %s [Error %d: %s]", _name, (int)dwRetVal, Error::getMessage(dwRetVal))); + } +} + + +NamedEventImpl::~NamedEventImpl() +{ + CloseHandle(_event); +} + + +void NamedEventImpl::setImpl() +{ + if (!SetEvent(_event)) + throw SystemException("cannot signal named event", _name); +} + + +void NamedEventImpl::waitImpl() +{ + switch (WaitForSingleObject(_event, INFINITE)) + { + case WAIT_OBJECT_0: + return; + default: + throw SystemException("wait for named event failed", _name); + } +} + + +} // namespace Poco |