Documentation ¶
Overview ¶
Example ¶
package main import ( "log" "time" "blake.io/forks" ) func main() { if forks.Child() { doBackgroundWorkDetached() } else { log.Fatal(forks.Maybe("", 24*time.Hour)) } } func doBackgroundWorkDetached() { // do some work }
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 in the last duration d.
If d is negative or zero, the touch file is touched and process is forked immediately.
It is an error to call Maybe from a child process forked by Maybe.
It returns an error if any.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.