# Path: forsun/status.py
# class ForsunStatus(object):
#     def __init__(self):
#     def inc(self, key, value = 1):
#     def get_info(self):


import time
import signal
import traceback
import logging
import threading
from collections import deque
from .status import forsun_status
    global __time_out_callback, __exit_callback, __is_stop
    __time_out_callback = None
    __exit_callback = None
    __is_stop = True
    logging.info("timer stoping")

def loop():
    signal.signal(signal.SIGHUP, exit_handler)
    signal.signal(signal.SIGINT, exit_handler)
    signal.signal(signal.SIGTERM, exit_handler)
    signal.signal(signal.SIGALRM, handler)
    signal.setitimer(signal.ITIMER_REAL, 1, 1)
    logging.info("timer ready")
    while not __is_stop:
        try:
            if __queues:
                callback, args = __queues.popleft()
                if callback and callable(callback):
                    callback(*args)
                continue

            if __queue_ready_event.is_set():
                __queue_ready_event.clear()

            if not __queues:
                __queue_ready_event.wait(1.3)
            forsun_status.timer_loop_count += 1
        except KeyboardInterrupt:
            if __exit_callback and callable(__exit_callback):
                __exit_callback()

# Path: forsun/status.py
# class ForsunStatus(object):
#     def __init__(self):
#     def inc(self, key, value = 1):
#     def get_info(self):


# Path: forsun/timer.py
import time
import signal
import traceback
import logging
import threading
from collections import deque
from .status import forsun_status

    global __time_out_callback, __exit_callback, __is_stop
    __time_out_callback = None
    __exit_callback = None
    __is_stop = True
    logging.info("timer stoping")

def loop():
    signal.signal(signal.SIGHUP, exit_handler)
    signal.signal(signal.SIGINT, exit_handler)
    signal.signal(signal.SIGTERM, exit_handler)
    signal.signal(signal.SIGALRM, handler)
    signal.setitimer(signal.ITIMER_REAL, 1, 1)
    logging.info("timer ready")
    while not __is_stop:
        try:
            if __queues:
                callback, args = __queues.popleft()
                if callback and callable(callback):
                    callback(*args)
                continue

            if __queue_ready_event.is_set():
                __queue_ready_event.clear()

            if not __queues:
                __queue_ready_event.wait(1.3)
            forsun_status.timer_loop_count += 1
        except KeyboardInterrupt:
            if __exit_callback and callable(__exit_callback):
                __exit_callback()

        except Exception as e: