diff options
| author | ruki <[email protected]> | 2019-07-26 22:15:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-07-26 07:34:36 +0800 |
| commit | dd488ffd6dc1ec44b3d0c38a9dfd5f0ca99d6d2f (patch) | |
| tree | a4e730279fc121d409c5508a0e0828bd10a39114 /core/src/xmake/io/filelock_trylock.c | |
| parent | 59472a642f18bf17953deddd82c68678d40fa254 (diff) | |
improve file lock count
Diffstat (limited to 'core/src/xmake/io/filelock_trylock.c')
| -rw-r--r-- | core/src/xmake/io/filelock_trylock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/src/xmake/io/filelock_trylock.c b/core/src/xmake/io/filelock_trylock.c index f13d04936..9f8a9dfd4 100644 --- a/core/src/xmake/io/filelock_trylock.c +++ b/core/src/xmake/io/filelock_trylock.c @@ -62,8 +62,9 @@ tb_int_t xm_io_filelock_trylock(lua_State* lua) else { // try to lock it - if (lock->is_locked || tb_filelock_enter_try(lock->lock_ref, is_shared? TB_FILELOCK_MODE_SH : TB_FILELOCK_MODE_EX)) + if (lock->nlocked > 0 || tb_filelock_enter_try(lock->lock_ref, is_shared? TB_FILELOCK_MODE_SH : TB_FILELOCK_MODE_EX)) { + lock->nlocked++; lua_pushboolean(lua, tb_true); xm_io_filelock_return_success(); } |
