File size: 877 Bytes
4585d4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from multiprocessing import Process
from threading import Thread


def keepAliveD(daemon: bool = True):
    """Supports daemon threads"""

    def outer(fc):
        def inner(*args):
            t = Thread(name=fc.__name__, target=fc, args=args, daemon=daemon)
            t.start()

        return inner

    return outer


def keepAlive(fc):
    def inner(*args):
        t = Thread(name=fc.__name__, target=fc, args=args, daemon=False)
        t.start()

    return inner


def undeadD(daemon=True):
    """ "Supports daemon process"""

    def outer(fc):
        def inner(*args):
            p = Process(name=fc.__name__, target=fc, args=args, daemon=daemon)
            p.start()

        return inner

    return outer


def undead(fc):
    def inner(*args):
        p = Process(name=fc.__name__, target=fc, args=args, daemon=False)
        p.start()

    return inner