Documentation ¶
Overview ¶
Example ¶
package main import ( "log" "time" "blake.io/forks" ) func main() { if forks.Maybe(24*time.Hour, nil) { log.Println("I am the parent") } else { log.Println("I am the child") } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Maybe ¶
Maybe forks the current process if no other run of the binary in the same install location has been run within the amount of time specified by wait.
If an error occurs and fatalf is non-nil, the error is logged to fatalf; otherwise no error is logged.
If wait is negative or zero, the touch file is touched and process is forked immediately.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.