Projekt

Allgemein

Profil

Event loop chain » Historie » Version 1

Maximilian Seesslen, 10.09.2025 11:39

1 1 Maximilian Seesslen
h1. Event loop chain
2
3
4
<pre><code class="cpp">
5
#include <stdlib.h>
6
#include <stdint.h>
7
#include <stdio.h>
8
9
#include "/home/deseessm/wp/src/canswitch/liblepto/include/lepto/signal.h"
10
11
class CEventLoop
12
{
13
   private:
14
      static CEventLoop* m_first;
15
      CEventLoop* m_next=nullptr;
16
17
   public:
18
      CEventLoop()
19
      {
20
         if(!m_first)
21
         {
22
            m_first=this;
23
         }
24
         else
25
         {
26
            CEventLoop* p=m_first;
27
            while( p->m_next)
28
            {
29
               p=p->m_next;
30
            }
31
            p->m_next=this;
32
         }
33
      }
34
      virtual void eventLoop()
35
      {
36
         printf("L %p\n", this);
37
      }
38
      static void allEventLoops()
39
      {
40
         CEventLoop* p=m_first;
41
         while(p)
42
         {
43
            p->eventLoop();
44
            p=p->m_next;
45
         }
46
      }
47
};
48
49
CEventLoop* CEventLoop::m_first = nullptr;
50
</pre>