Home | History | Annotate | Download | only in dbus
      1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
      2 /* dbus-mainloop.h  Main loop utility
      3  *
      4  * Copyright (C) 2003  Red Hat, Inc.
      5  *
      6  * Licensed under the Academic Free License version 2.1
      7  *
      8  * This program is free software; you can redistribute it and/or modify
      9  * it under the terms of the GNU General Public License as published by
     10  * the Free Software Foundation; either version 2 of the License, or
     11  * (at your option) any later version.
     12  *
     13  * This program is distributed in the hope that it will be useful,
     14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  * GNU General Public License for more details.
     17  *
     18  * You should have received a copy of the GNU General Public License
     19  * along with this program; if not, write to the Free Software
     20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     21  *
     22  */
     23 
     24 #ifndef DBUS_MAINLOOP_H
     25 #define DBUS_MAINLOOP_H
     26 
     27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
     28 
     29 #include <dbus/dbus.h>
     30 
     31 typedef struct DBusLoop DBusLoop;
     32 
     33 typedef dbus_bool_t (* DBusWatchFunction)   (DBusWatch     *watch,
     34                                              unsigned int   condition,
     35                                              void          *data);
     36 typedef void        (* DBusTimeoutFunction) (DBusTimeout   *timeout,
     37                                              void          *data);
     38 
     39 DBusLoop*   _dbus_loop_new            (void);
     40 DBusLoop*   _dbus_loop_ref            (DBusLoop            *loop);
     41 void        _dbus_loop_unref          (DBusLoop            *loop);
     42 dbus_bool_t _dbus_loop_add_watch      (DBusLoop            *loop,
     43                                        DBusWatch           *watch,
     44                                        DBusWatchFunction    function,
     45                                        void                *data,
     46                                        DBusFreeFunction     free_data_func);
     47 void        _dbus_loop_remove_watch   (DBusLoop            *loop,
     48                                        DBusWatch           *watch,
     49                                        DBusWatchFunction    function,
     50                                        void                *data);
     51 dbus_bool_t _dbus_loop_add_timeout    (DBusLoop            *loop,
     52                                        DBusTimeout         *timeout,
     53                                        DBusTimeoutFunction  function,
     54                                        void                *data,
     55                                        DBusFreeFunction     free_data_func);
     56 void        _dbus_loop_remove_timeout (DBusLoop            *loop,
     57                                        DBusTimeout         *timeout,
     58                                        DBusTimeoutFunction  function,
     59                                        void                *data);
     60 
     61 dbus_bool_t _dbus_loop_queue_dispatch (DBusLoop            *loop,
     62                                        DBusConnection      *connection);
     63 
     64 void        _dbus_loop_run            (DBusLoop            *loop);
     65 void        _dbus_loop_quit           (DBusLoop            *loop);
     66 dbus_bool_t _dbus_loop_iterate        (DBusLoop            *loop,
     67                                        dbus_bool_t          block);
     68 dbus_bool_t _dbus_loop_dispatch       (DBusLoop            *loop);
     69 
     70 int  _dbus_get_oom_wait    (void);
     71 void _dbus_wait_for_memory (void);
     72 
     73 #endif /* !DOXYGEN_SHOULD_SKIP_THIS */
     74 
     75 #endif /* DBUS_MAINLOOP_H */
     76 
     77