FBB::Selector(3bobcat)

Timed Delays, Multiple File I/O
(libbobcat-dev_6.02.02)

2005-2022

NAME

FBB::Selector - Timed delays, Alarms and Multiple File I/O.

SYNOPSIS

#include <bobcat/selector>
Linking option: -lbobcat

DESCRIPTION

FBB::Selector objects are wrappers around the select(2) system calls and allow timed delays, alarm functionality and/or multiple file I/O. It requires the use of file descriptors, which are not an official part of C++. However, most operating systems offer file descriptors. Sockets are well-known file descriptors.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

-

CONSTRUCTORS

Copy and move constructors (and assignment operators) are available.

MEMBER FUNCTIONS

EXAMPLE


#include <string>
#include <iostream>

#include <bobcat/selector>
#include <bobcat/exception>

using namespace std;
using namespace FBB;

int main(int argc, char **argv, char **envp)
try
{
    Selector selector;

    selector.setAlarm(5);               // every 5 secs: alarm fires
    selector.addReadFd(STDIN_FILENO);   // look also at cin

    while (true)
    {
        if (!selector.wait())           // 0: alarm fires
            cout << "Are you still there?" << endl;
        else
        {
            string s;
            if (!getline(cin, s) || !s.length())
                return 0;
            cout << "Thank you for: " << s << endl;
        }
    }
}
catch (Exception const &e)
{
    cout << e.what() << '\n';
    return 1;
}
    

FILES

bobcat/selector - defines the class interface

SEE ALSO

bobcat(7), select(2)

BUGS

None reported

BOBCAT PROJECT FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).