Skip to content

Commit

Permalink
replace battery event loop fork with thread
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Oct 23, 2024
1 parent f9f0fb4 commit b924780
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
log_begin()
log("Starting Pardus Power Manager Service")

if os.fork():
@asynchronous
def battery_loop():
interval = int(get("update-interval",60, "service"))
while True:
time.sleep(interval)
data = {}
data["pid"] = os.getpid()
data["update"] = "service"
writefile("/run/ppm",json.dumps(data))
main(json.dumps(data))

battery_loop()

# set initial mode state
mode = get("ac-mode","performance","modes")
Expand Down

0 comments on commit b924780

Please sign in to comment.