module Thyme::ProcessHandler

Overview

Handles all things related to PID!

The Thyme timer runs as a daemon process. Stopping/pausing/unpausing are all initiated by a secondary process. It sends a signal to the main daemon. In order to do so, it needs the daemon's PID which is stored in the PID_FILE.

See Thyme::SignalHandler for the actual message sending. This module only deals with reading/writing the daemon's PID.

Extended Modules

Defined in:

thyme/process_handler.cr

Constant Summary

PID_FILE = "#{ENV["HOME"]}/.thyme-pid"

Instance Method Summary

Instance Method Detail

def delete_pid #

Clean up by removing PID_FILE.


[View source]
def read_pid #

Returns the PID of the main daemon process. Should only be used by the secondary processes (eg during stopping/pausing/unpausing).


[View source]
def running? #

Returns true if main daemon is running.


[View source]
def write_pid #

Writes the current process's PID to the PID_FILE. Must only be used by the main process. Must never be used by secondary processes.


[View source]