You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2017/04/16 10:28:51 UTC
[13/16] lucy git commit: Move host ivar from Lock to LockFileLock
Move host ivar from Lock to LockFileLock
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/2bd2bc61
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/2bd2bc61
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/2bd2bc61
Branch: refs/heads/master
Commit: 2bd2bc611325ee643f325ecfd11d5227319949a8
Parents: d23b560
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Feb 19 16:21:00 2017 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Feb 20 16:51:32 2017 +0100
----------------------------------------------------------------------
core/Lucy/Store/Lock.c | 10 +++++-----
core/Lucy/Store/Lock.cfh | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/2bd2bc61/core/Lucy/Store/Lock.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.c b/core/Lucy/Store/Lock.c
index c4542a6..e716099 100644
--- a/core/Lucy/Store/Lock.c
+++ b/core/Lucy/Store/Lock.c
@@ -30,8 +30,8 @@
#include "Lucy/Util/Sleep.h"
Lock*
-Lock_init(Lock *self, Folder *folder, String *name,
- String *host, int32_t timeout, int32_t interval) {
+Lock_init(Lock *self, Folder *folder, String *name, int32_t timeout,
+ int32_t interval) {
LockIVARS *const ivars = Lock_IVARS(self);
// Validate.
@@ -58,7 +58,6 @@ Lock_init(Lock *self, Folder *folder, String *name,
ivars->folder = (Folder*)INCREF(folder);
ivars->timeout = timeout;
ivars->name = Str_Clone(name);
- ivars->host = Str_Clone(host);
ivars->interval = interval;
// Derive.
@@ -71,7 +70,6 @@ void
Lock_Destroy_IMP(Lock *self) {
LockIVARS *const ivars = Lock_IVARS(self);
DECREF(ivars->folder);
- DECREF(ivars->host);
DECREF(ivars->name);
DECREF(ivars->lock_path);
SUPER_DESTROY(self, LOCK);
@@ -145,8 +143,9 @@ LockFileLock*
LFLock_init(LockFileLock *self, Folder *folder, String *name, String *host,
int32_t timeout, int32_t interval, bool exclusive_only) {
int pid = PID_getpid();
- Lock_init((Lock*)self, folder, name, host, timeout, interval);
+ Lock_init((Lock*)self, folder, name, timeout, interval);
LockFileLockIVARS *const ivars = LFLock_IVARS(self);
+ ivars->host = (String*)INCREF(host);
ivars->link_path = Str_newf("%o.%o.%i64", ivars->lock_path, host,
(int64_t)pid);
ivars->exclusive_only = exclusive_only;
@@ -455,6 +454,7 @@ void
LFLock_Destroy_IMP(LockFileLock *self) {
LockFileLockIVARS *const ivars = LFLock_IVARS(self);
if (ivars->state != LFLOCK_STATE_UNLOCKED) { LFLock_Release(self); }
+ DECREF(ivars->host);
DECREF(ivars->link_path);
SUPER_DESTROY(self, LOCKFILELOCK);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2bd2bc61/core/Lucy/Store/Lock.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.cfh b/core/Lucy/Store/Lock.cfh
index 6a4b719..11f31c0 100644
--- a/core/Lucy/Store/Lock.cfh
+++ b/core/Lucy/Store/Lock.cfh
@@ -32,7 +32,6 @@ abstract class Lucy::Store::Lock inherits Clownfish::Obj {
Folder *folder;
String *name;
String *lock_path;
- String *host;
int32_t timeout;
int32_t interval;
@@ -47,8 +46,8 @@ abstract class Lucy::Store::Lock inherits Clownfish::Obj {
* @param interval Time in milliseconds between retries.
*/
public inert Lock*
- init(Lock *self, Folder *folder, String *name,
- String *host, int32_t timeout = 0, int32_t interval = 100);
+ init(Lock *self, Folder *folder, String *name, int32_t timeout = 0,
+ int32_t interval = 100);
/** Call [](.Request_Shared) once per `interval` until [](.Request_Shared)
* returns success or the `timeout` has been reached.
@@ -103,6 +102,7 @@ abstract class Lucy::Store::Lock inherits Clownfish::Obj {
class Lucy::Store::LockFileLock nickname LFLock
inherits Lucy::Store::Lock {
+ String *host;
String *shared_lock_path;
String *link_path;
int state;