SigHand.hh

00001 //********************************************************************
00002 //*** Thread/Sighand.hh
00003 //*** Copyright (c) 2003-2009 by Markus Winand <mws@fatalmind.com>
00004 //*** $Id: SigHand.hh,v 1.5 2009-03-02 14:16:46 mws Exp $
00005 //********************************************************************
00006 #ifndef INCLUDED_SIGHAND_HH
00007 #define INCLUDED_SIGHAND_HH
00008 
00009 #include <map>
00010 #include <memory>
00011 
00012 #ifndef INCLUDED_GC_PTR_HH
00013 #include "mm/gc_ptr.hh"
00014 #endif
00015 
00016 #ifndef INCLUDED_TASK_HH
00017 #include "Thread/Task.hh"
00018 #endif
00019 
00020 namespace fatalmind {
00021 
00022 class SigHand {
00023     public:
00024         typedef int id_t;
00025         typedef int sig_t;
00026         id_t setHandler(std::auto_ptr<Task> task);
00027         std::auto_ptr<Task> removeHandler(id_t);
00028 
00029         static SigHand& getInstance(sig_t);
00030     private:
00031         static void jumpinpoint(sig_t);
00032         void handle();
00033         SigHand(sig_t);
00034         SigHand(const SigHand&);
00035 
00036         typedef std::map<sig_t, gc_ptr<SigHand> > map_t;
00037         static map_t _sighand;
00038 
00039         typedef std::map<id_t, gc_ptr<Task> > tasks_t;
00040         tasks_t _tasks;
00041         id_t _nextid;
00042         sig_t _sig;
00043 };
00044 
00045 } // namespace fatalmind
00046 #endif

Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3