Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • e6a1fd0
  • /
  • include
  • /
  • internal
  • /
  • rio_notifier.h
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:f015bf38cfd07ef9a7cd4a2ffcaf77388e509d59
directory badge Iframe embedding
swh:1:dir:c2e7951ae1df1f3ff55f3f07ee0bc440c3c8d639
rio_notifier.h
/*
 * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */
#ifndef OSSL_RIO_NOTIFIER_H
# define OSSL_RIO_NOTIFIER_H

# include "internal/common.h"
# include "internal/sockets.h"

/*
 * Pollable Notifier
 * =================
 *
 * RIO_NOTIFIER provides an OS-pollable resource which can be plugged into an
 * OS's socket polling APIs to allow socket polling calls to be woken
 * artificially by other threads.
 */
# define RIO_NOTIFIER_METHOD_SOCKET      1
# define RIO_NOTIFIER_METHOD_SOCKETPAIR  2

# if !defined(RIO_NOTIFIER_METHOD)
#  if defined(OPENSSL_SYS_WINDOWS)
#   define RIO_NOTIFIER_METHOD          RIO_NOTIFIER_METHOD_SOCKET
#  elif defined(OPENSSL_SYS_UNIX)
#   define RIO_NOTIFIER_METHOD          RIO_NOTIFIER_METHOD_SOCKETPAIR
#  else
#   define RIO_NOTIFIER_METHOD          RIO_NOTIFIER_METHOD_SOCKET
#  endif
# endif

typedef struct rio_notifier_st {
    int rfd, wfd;
} RIO_NOTIFIER;

/*
 * Initialises a RIO_NOTIFIER. Returns 1 on success or 0 on failure.
 */
int ossl_rio_notifier_init(RIO_NOTIFIER *nfy);

/*
 * Cleans up a RIO_NOTIFIER, tearing down any allocated resources.
 */
void ossl_rio_notifier_cleanup(RIO_NOTIFIER *nfy);

/*
 * Signals a RIO_NOTIFIER, waking up any waiting threads.
 */
int ossl_rio_notifier_signal(RIO_NOTIFIER *nfy);

/*
 * Unsignals a RIO_NOTIFIER.
 */
int ossl_rio_notifier_unsignal(RIO_NOTIFIER *nfy);

/*
 * Returns an OS socket handle (FD or Win32 SOCKET) which can be polled for
 * readability to determine when the notifier has been signalled.
 */
static ossl_inline ossl_unused int ossl_rio_notifier_as_fd(RIO_NOTIFIER *nfy)
{
    return nfy->rfd;
}

#endif

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top