一个简单的锁库 Keyway

码农软件 · 软件分类 · 其他开发相关 · 2019-10-21 14:44:28

软件介绍

A simple lock file library.

Features
  • Provides mutual exclusion for scripts that require the same resource.

  • Requires three additional lines of code in your script, including sourcing the library.

  • Scripts using Keyway can be configured to either terminate or busy-wait if a resource is blocked.

  • Keyway will report when an external error was caught and there are lock files in the lock directory.

Usage:
  • acquire_lock_for "your_task_name"

    • If the resource is not locked, your task will execute, otherwise it will terminate.

  • acquire_spinlock_for "your_task_name"

    • If the resource is locked, your task will wait until the lock has been released before acquiring its own lock and executing.

Return Code Explanations:
  1. Your application was not able to acquire lock.

  2. There was some other problem:

  • Keyway could not create the lock directory.

  • Keyway could not create or remove a lock.

  • An error was caught and there are lock files in the lock directory.

  • An example:
    #!/bin/bash
    source keyway_lib.sh
    
    # optionally override the lock file directory
    LOCK_DIR="alt-lock-dir"
    
    # attempt to lock the shared resource
    acquire_lock_for "your_task_name"
    
    # if the lock was successful, execute the task
    echo "executing critical section"
    
    # release the lock when the task is done
    release_lock_for "your_task_name"

    GPRS_core_structure.png

    本文地址:https://codercto.com/soft/d/17247.html

    大师之路

    大师之路

    赵鹏 / 人民邮电出版社 / 2007-12 / 79.00元

    《大师之路:Photoshop中文版完全解析》以介绍Photoshop选区、图层、路径3大基础为主线,从色彩原理入手,注重基础知识,辅以大量实例,全面剖析了Photoshop的应用。对于其他内容,如色彩调整和各类工具的应用,也均采用与实际操作相结合的方式进行讲解。另外,还简单明了地介绍了扩展应用的领域。所附教学光盘的内容可自成一套独立的视频教学体系。本书完全按照初学者的认知角度编写,重点介绍图像原......一起来看看 《大师之路》 这本书的介绍吧!

    HTML 压缩/解压工具
    HTML 压缩/解压工具

    在线压缩/解压 HTML 代码

    图片转BASE64编码
    图片转BASE64编码

    在线图片转Base64编码工具

    随机密码生成器
    随机密码生成器

    多种字符组合密码