Fresco/Prague/include/Prague/IPC Dispatcher.hh,1.11,1.12

Tobias Hunger <[email protected]> Sat, 01 Nov 2003 12:54:29 +0000
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Prague/include/Prague/IPC
In directory purcel:/tmp/cvs-serv2570/Prague/include/Prague/IPC

Modified Files:
	Dispatcher.hh 
Log Message:
* Let task handle refcounting of agents.
* Some threading fix in wait()
* Refactor some common code into new memebr release(agent, fd, iter, iter)


Index: Dispatcher.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/IPC/Dispatcher.hh,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Dispatcher.hh	31 Oct 2003 22:33:09 -0000	1.11
+++ Dispatcher.hh	1 Nov 2003 12:54:26 -0000	1.12
@@ -2,6 +2,7 @@
  *
  * This source file is a part of the Fresco Project.
  * Copyright (C) 1999, 2000 Stefan Seefeld <[email protected]>
+ * Copyright (C) 2003 Tobias Hunger <[email protected]>
  * http://www.fresco.org
  *
  * This library is free software; you can redistribute it and/or
@@ -22,7 +23,6 @@
 #ifndef _Prague_Dispatcher_hh
 #define _Prague_Dispatcher_hh
 
-#include <Prague/Sys/Signal.hh>
 #include <Prague/Sys/FdSet.hh>
 #include <Prague/Sys/ThreadPool.hh>
 #include <Prague/IPC/Agent.hh>
@@ -48,26 +48,28 @@
       //. release an Agent from channel fd, or the whole Agent, if fd is -1
       void release(Agent *, int fd = -1);
     private:
-      typedef std::vector<Agent *> alist_t;
       struct task;
       typedef std::map<int, task *> repository_t;
       //. Handler is responsible for calling a specific method
       //. (determined by the mask) on the agent
       struct Handler
       {
-          Handler(task *tt) : t(tt) {}
-          void process() { dispatcher->process(t);}
+          Handler(task *tt) : t(tt) { }
+          void process() { dispatcher->process(t); }
           task *t;
       };
       friend struct Handler;
-      struct Acceptor { Handler *consume(task *t) const { return new Handler(t);}};
-      struct Cleaner { ~Cleaner();};
+      struct Acceptor { Handler *consume(task *t) const { return new Handler(t); } };
+      struct Cleaner { ~Cleaner(); };
       friend struct Cleaner;
       typedef Thread::Queue<task *> Queue;
       typedef ThreadPool<task *, Acceptor, Handler> Pool;
 
       Dispatcher();
       virtual ~Dispatcher();
+
+      void release(Agent *, int, repository_t::iterator, repository_t::iterator);
+
       void wait();
       void notify() { char *c = "c"; write(my_wakeup[1], c, 1); }
       static void *run(void *);
@@ -84,7 +86,6 @@
       FdSet        my_rfds;
       FdSet        my_wfds;
       FdSet        my_xfds;
-      alist_t      my_agents;
       repository_t my_rchannel;
       repository_t my_wchannel;
       repository_t my_xchannel;