poco/Foundation/src/NamedEvent_VMS.cpp
Roger Meier b0581433a7 LICENSE: add info about SPDX-License-Identifier usage and use it
fix: remove executable flag and change back to 100644 (was 100755)

Signed-off-by: Roger Meier <r.meier@siemens.com>
2014-05-14 08:38:09 +02:00

66 lines
1.3 KiB
C++

//
// NamedEvent_VMS.cpp
//
// $Id: //poco/1.4/Foundation/src/NamedEvent_VMS.cpp#1 $
//
// 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_VMS.h"
#include <lib$routines.h>
#include <starlet.h>
#include <descrip.h>
#include <iodef.h>
namespace Poco {
NamedEventImpl::NamedEventImpl(const std::string& name):
_name(name)
{
struct dsc$descriptor_s mbxDesc;
mbxDesc.dsc$w_length = _name.length();
mbxDesc.dsc$b_dtype = DSC$K_DTYPE_T;
mbxDesc.dsc$b_class = DSC$K_CLASS_S;
mbxDesc.dsc$a_pointer = _name.c_str();
if (sys$crembx(0, &_mbxChan, 0, 0, 0, 0, &mbxDesc, 0, 0) != 1)
throw SystemException("cannot create named event", _name);
}
NamedEventImpl::~NamedEventImpl()
{
sys$dassgn(_mbxChan);
}
void NamedEventImpl::setImpl()
{
char buffer = 0xFF;
if (sys$qio(0, _mbxChan, IO$_WRITEVBLK, 0, 0, 0, &buffer, sizeof(buffer), 0, 0, 0, 0) != 1)
throw SystemException("cannot set named event", _name);
}
void NamedEventImpl::waitImpl()
{
char buffer = 0;
while (buffer == 0)
{
if (sys$qiow(0, _mbxChan, IO$_READVBLK, 0, 0, 0, &buffer, sizeof(buffer), 0, 0, 0, 0) != 1)
throw SystemException("cannot wait for named event", _name);
}
}
} // namespace Poco