Mercurial Hosting > luan
diff src/luan/modules/ThreadLuan.java @ 1381:8d7a39ca2c0c
add Rpc in_backup_read_lock
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 28 Jul 2019 20:15:38 -0600 |
parents | 431d5bec3ca4 |
children | eb8b35dccd99 |
line wrap: on
line diff
--- a/src/luan/modules/ThreadLuan.java Sun Jul 28 11:06:37 2019 -0600 +++ b/src/luan/modules/ThreadLuan.java Sun Jul 28 20:15:38 2019 -0600 @@ -238,11 +238,17 @@ public static final ReadWriteLock backupLock = new ReentrantReadWriteLock(); - public static Object runInLock(Lock lock,LuanFunction fn,Object... args) + public static void lock(Lock lock) throws LuanException, InterruptedException { if( !lock.tryLock(10,TimeUnit.MINUTES) ) throw new LuanException("failed to acquire lock"); + } + + public static Object runInLock(Lock lock,LuanFunction fn,Object... args) + throws LuanException, InterruptedException + { + lock(lock); try { return fn.call(args); } finally {