util

package
v0.9.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2015 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

ユーティリティ関数のパッケージ。

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBusy = errors.New("Locked by other process.")
)

Functions

func GetCurrentPath

func GetCurrentPath() string

現在のフォルダパスを返す。

func GetRootPath

func GetRootPath() string

Rootフォルダを取得する

func IsProcessExists

func IsProcessExists(pid int) bool

IsProcessExists checks if process with pid running or not running.

func JobnameHasInvalidRune

func JobnameHasInvalidRune(jobname string) bool

指定したジョブ名に、禁止文字が存在するか確認する。 現在の仕様では 「 \/:*?"<>|$ 」の記号が使用禁止。

param : jobname ジョブ名。

return : 禁止文字が含まれている場合はtrueを返す。

Types

type LockHandle

type LockHandle struct {
	// contains filtered or unexported fields
}

func InitLock

func InitLock(name string) (*LockHandle, error)

ファイルを利用した同期処理機能の初期化関数。 ファイル作成が可能なファイル名を指定します。

func (*LockHandle) Lock

func (l *LockHandle) Lock(timeout_millisec int) error

ファイルを利用して、ロックを行います。 引数で指定したミリ秒まで待機します。0以下を指定した場合は、リトライしません。 他プロセスのロックが指定時間内に解けなかった場合は、ErrBusy を返します。

func (*LockHandle) TermLock

func (l *LockHandle) TermLock() error

ロックファイルの終了処理。InitLock()成功後は、必ず呼び出して下さい。

func (*LockHandle) Unlock

func (l *LockHandle) Unlock() error

ロック解除。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL