一个简单的锁库 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

    互联网:碎片化生存

    互联网:碎片化生存

    段永朝 / 中信出版社 / 2009-11 / 42.00元

    《互联网:碎片化生存》内容简介:在世界互联网人数超过17亿,中国网民接近4亿的时候,断言“这个版本的互联网没有未来”是要冒很大风险的。我们生活在比特和连线的世界,现代互联网所描绘出的“数字化”、“虚拟化”的未来是否完全值得信赖? 现代商业取得了巨大成功,但这并不是电脑和互联网精髓的自由体现,我们所使用的这个版本的电脑和互联网只不过是“被阉割”、“被劫持”的商业玩偶。 《互联网:碎片化生......一起来看看 《互联网:碎片化生存》 这本书的介绍吧!

    JS 压缩/解压工具
    JS 压缩/解压工具

    在线压缩/解压 JS 代码

    html转js在线工具
    html转js在线工具

    html转js在线工具

    正则表达式在线测试
    正则表达式在线测试

    正则表达式在线测试