summaryrefslogtreecommitdiff
path: root/src/IO/iowatch.cc
blob: 13c537fefacd02f8f8e8c4bd436f5d213c897d85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * File: iowatch.cc
 *
 * Copyright (C) 2005-2007 Jorge Arellano Cid <jcid@dillo.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 */

/** @file
 * Simple ADT for watching file descriptor activity
 */

#include <FL/Fl.H>
#include "iowatch.hh"

/**
 * Hook a Callback for a certain activities in a FD
 */
void a_IOwatch_add_fd(int fd, int when, Fl_FD_Handler Callback,
                      void *usr_data = 0)
{
   if (fd >= 0)
      Fl::add_fd(fd, when, Callback, usr_data);
}

/**
 * Remove a Callback for a given FD (or just remove some events)
 */
void a_IOwatch_remove_fd(int fd, int when)
{
   if (fd >= 0)
      Fl::remove_fd(fd, when);
}