• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • OSAPIEventWithFd
  • 5.0.0

OSAPIEventWithFd Class

The OSAPIEventWithFd is a Windows and Linux conformant event which is listened to by calling poll() or select() on the caller thread. More...

Header: #include <OSAPIEventWithFd>
  • List of all members, including inherited members

Public Functions

OSAPIEventWithFd()
~OSAPIEventWithFd()
OSAPIFILEDESCRIPTOR GetFd()
bool IsSignalled()
void Reset()
void Set()

Detailed Description

The OSAPIEventWithFd is a Windows and Linux conformant event which is listened to by calling poll() or select() on the caller thread.

Example:

/**
 * (c)2017 CDP Technologies AS
 */

// signaller thread:
OSAPIEventWithFd osapiEvent;
osapiEvent.Set();
...
// listener thread:
#include <OSAPI/Process/OSAPIProcess.h>

std::vector<OSAPIFILEDESCRIPTOR> fds;
fd_set fdset;
fds.push_back(osapiEvent->GetFd());

int ret = OSAPISelect(fds, &fdset, 10));
if(ret >= 0)
{
  if(ret > 0)
  {
    if(FD_ISSET(osapiEvent->GetFd(), &fdset)
    {
      // osapiEvent received!
    }
  }
}
else
{
  // error handling
}

See also OSAPIEvent.

Member Function Documentation

OSAPIEventWithFd::OSAPIEventWithFd()

Constructs an event.

OSAPIEventWithFd::~OSAPIEventWithFd()

Destructs the event.

OSAPIFILEDESCRIPTOR OSAPIEventWithFd::GetFd()

Gets the underlying file descriptor of the event, which can be used to wait for event, using poll() or select().

Returns the descriptor

bool OSAPIEventWithFd::IsSignalled()

Returns true if event is in signaled state, otherwise false.

void OSAPIEventWithFd::Reset()

Sets the event to nonsignaled state

void OSAPIEventWithFd::Set()

Sets the event

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2024 CDP Technologies. Privacy and cookie policy.

Return to top