1 /*
2  * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9 #pragma once
10 
11 #include <l4/cxx/exceptions>
12 #include <l4/sys/cxx/ipc_epiface>
13 #include <l4/re/util/object_registry>
14 #include <pthread.h>
15 #include <cstdio>
16 
17 namespace Ned {
18 
19 class Server_object : public L4::Epiface
20 {};
21 
22 class Registry : public L4Re::Util::Object_registry
23 {
24 public:
Registry(L4::Ipc_svr::Server_iface * sif,L4::Cap<L4::Thread> t,L4::Cap<L4::Factory> f)25   Registry(L4::Ipc_svr::Server_iface *sif,
26            L4::Cap<L4::Thread> t, L4::Cap<L4::Factory> f)
27   : L4Re::Util::Object_registry(sif, t, f) {}
28 
~Registry()29   ~Registry() { printf("destroy registry\n"); }
30 };
31 
32 class Server : public L4::Server<>
33 {
34 private:
35   Registry *_r;
36   pthread_t _th;
37   pthread_mutex_t _start_mutex;
38   static void *__run(void *);
39 
40   void run();
41 public:
42   typedef L4::Server<> Base;
43 
44   Server();
45 
registry()46   Registry *registry() { return _r; }
47 };
48 
49 extern Server *server;
50 
51 }
52 
53 
54