{"modulePath":"github.com/codedellemc/libstorage","version":"v0.1.0","isLatest":false,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package semaphore\n\n## Functions\n\n```go\nfunc Unlink(name string) error\n```\nUnlink removes the named semaphore referred to by name. The semaphore name is removed immediately. The semaphore is destroyed once all other processes that have the semaphore open close it.\n\n## Types\n\n```go\ntype Semaphore interface {\n\n\t// Name returns the name of the semaphore.\n\tName() string\n\n\t// Close closes the semaphore.\n\tClose() error\n\n\t// Signal increments (unlocks) the semaphore pointed to by sem.  If\n\t// the semaphore's value consequently becomes greater than zero, then\n\t// another process or thread blocked in a Wait() call will be woken\n\t// up and proceed to lock the semaphore.\n\tSignal() error\n\n\t// Wait decrements (locks) the semaphore pointed to by sem.  If\n\t// the semaphore's value is greater than zero, then the decrement\n\t// proceeds, and the function returns, immediately.  If the semaphore\n\t// currently has the value zero, then the call blocks until either it\n\t// becomes possible to perform the decrement (i.e., the semaphore value\n\t// ises above zero), or a signal handler interrupts the call.\n\tWait() error\n\n\t// TryWait is the same as Wait(), except that if the decrement\n\t// cannot be immediately performed, then call returns a true flag and\n\t// no error.\n\tTryWait() (bool, error)\n\n\t// TimedWait is the same as Wait(), except that abs_timeout\n\t// specifies a limit on the amount of time that the call should block if\n\t// the decrement cannot be immediately performed.\n\tTimedWait(timeout time.Duration) error\n\n\t// Value returns the current value of the semaphore. If one or more\n\t// processes or threads are blocked waiting to lock the\n\t// semaphore with Wait(), POSIX.1 permits two possibilities for the\n\t// value returned in sval: either 0 is returned; or a negative number\n\t// whose absolute value is the count of the number of processes and\n\t// threads currently blocked in Wait().  Linux adopts the former\n\t// behavior.\n\tValue() (int, error)\n}\n```\nSemaphore enables processes and threads to synchronize their actions.\n\n```go\nfunc Open(\n\tname string, excl bool, perm os.FileMode, val int) (Semaphore, error)\n```\nOpen creates a new, named semaphore or opens an existing one if one exists with the given name.\n\n","path":"github.com/codedellemc/libstorage/api/utils/semaphore","name":"semaphore","synopsis":"","isRedistributable":true}
