Back to index

texmacs  1.0.7.15
Functions | Variables
socket_notifier.cpp File Reference
#include "config.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include "socket_notifier.hpp"
#include "list.hpp"
#include "iterator.hpp"

Go to the source code of this file.

Functions

void add_notifier (socket_notifier sn)
void remove_notifier (socket_notifier sn)
void perform_select ()

Variables

static hashset< socket_notifiernotifiers

Function Documentation

Definition at line 36 of file socket_notifier.cpp.

                                   {
  //cout << "enable notifier " << LF;
  notifiers->insert (sn);
#ifdef QTTEXMACS
  the_gui->add_notifier (sn);
#endif
} 

Here is the caller graph for this function:

void perform_select ( )

Definition at line 54 of file socket_notifier.cpp.

                  {
#ifndef __MINGW32__
  //FIXME: this can be optimizied
  while (true) {
    fd_set rfds;
    FD_ZERO (&rfds);
    int max_fd= 0;
    iterator<socket_notifier> it = iterate (notifiers);
    while (it->busy ()) {
      socket_notifier sn= it->next ();
      FD_SET (sn->fd, &rfds);
      if (sn->fd >= max_fd) max_fd= sn->fd+1;
    }
    if (max_fd == 0) break;
    
    struct timeval tv;
    tv.tv_sec  = 0;
    tv.tv_usec = 0;
    int nr = select (max_fd, &rfds, NULL, NULL, &tv);
    if (nr==0) break;
    
    it = iterate (notifiers);
    while (it->busy ()) {
      socket_notifier sn=  it->next ();
      if (FD_ISSET (sn->fd, &rfds)) sn->notify ();
    }
  }  
#endif  
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 45 of file socket_notifier.cpp.

                                      {
  //cout << "disable notifier " << LF;
  notifiers->remove (sn);
#ifdef QTTEXMACS
  the_gui->remove_notifier (sn);
#endif
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 33 of file socket_notifier.cpp.