PLock-简单高效的跨进程锁,支持读写锁分离.zip

时间:2022-10-13 18:46:47
【文件属性】:

文件名称:PLock-简单高效的跨进程锁,支持读写锁分离.zip

文件大小:657KB

文件格式:ZIP

更新时间:2022-10-13 18:46:47

开源项目

简单高效的跨进程锁,支持读写锁分离,  也可以用于文件锁Getting startedIn your build.gradle:allprojects {     repositories {         maven { url 'https://jitpack.io' }     } } dependencies {     implementation 'com.github.pqpo:PLock:{last-version}'}UsageStep 1. get a default PLock object, and you can also create one by yourself.Step 2. acquire locks.Step 3. unlock.Step 4. release if necessary.For example:PLock pLock = PLock.getDefault();// OR you can also use it as a file lock:// PLock pLock = new PLock(file);pLock.lock();  try {    // to do something...} catch (Exception e) {    // errors} finally {     pLock.unlock();  }// in non-blocking modeif(pLock.tryLock()) {   try {       // to do something...    } catch (Exception e) {       // errors    } finally {        pLock.unlock();     } }  // non-block read lockif(pLock.tryReadLock()) {    // to do something...}  // non-block write lockif(pLock.tryWriteLock()) {    // to do something...}  // etc.// pLock.release();Play with samples, have fun!You can clone this repository, then run 'debug' build variant and 'second' build variant, after that you can see two applications running on your phone which named PLock-FirstProcess and PLock-SecondProcess.Or download PLock-FirstProcess and PLock-SecondProcess.PLock-first-processPLock-second-process


【文件预览】:
PLock-master
----gradlew.bat(2KB)
----gradlew(5KB)
----art()
--------screenshot_plock_first.jpg(14KB)
--------qrcode_for_gh.jpg(38KB)
--------screenshot_plock_second.jpg(17KB)
----gradle.properties(849B)
----Logo()
--------Logo()
----LICENSE(11KB)
----app()
--------proguard-rules.pro(751B)
--------src()
--------.gitignore(7B)
--------build.gradle(1KB)
----gradle()
--------wrapper()
----.gitignore(766B)
----CHANGELOG.md(58B)
----plocklib()
--------proguard-rules.pro(751B)
--------src()
--------.gitignore(7B)
--------CMakeLists.txt(2KB)
--------build.gradle(1010B)
----README.md(4KB)
----settings.gradle(28B)
----releases()
--------plocklib-release-v1.0.0.aar(349KB)
----build.gradle(546B)

网友评论