diff options
author | Sung-jae Park <nicesj.park@samsung.com> | 2015-04-15 15:53:02 +0900 |
---|---|---|
committer | Sung-jae Park <nicesj.park@samsung.com> | 2015-04-15 15:53:02 +0900 |
commit | c62ca5b93d5f85313507564dd893448f338829ae (patch) | |
tree | 1b2767febcc17bfbc19867477b39a8ac6e7a07cc | |
parent | e20e306d32428f3778a464edbd8949870119a305 (diff) | |
download | widget-service-c62ca5b93d5f85313507564dd893448f338829ae.tar.gz widget-service-c62ca5b93d5f85313507564dd893448f338829ae.tar.bz2 widget-service-c62ca5b93d5f85313507564dd893448f338829ae.zip |
Create/Destroy lock updated.
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]
Change-Id: Iebc28de89f0878e4063c6b31ca6a68ba973a289c
-rw-r--r-- | include/widget_buffer.h | 7 | ||||
-rw-r--r-- | src/widget_service.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/include/widget_buffer.h b/include/widget_buffer.h index 4d6d994..2ce7cf8 100644 --- a/include/widget_buffer.h +++ b/include/widget_buffer.h @@ -105,6 +105,11 @@ typedef enum widget_lock_type { * @since_tizen 2.3.1 */ typedef struct widget_lock_info { + enum { + LOCK_INITIALIZED = 0xb0e0e0f0, + LOCK_CREATED = 0x0beef000, + LOCK_DESTROYED = 0x0dead000 + } state; char *filename; int fd; widget_lock_type_e type; @@ -120,7 +125,7 @@ typedef struct widget_buffer { enum { BUFFER_INITIALIZED = 0x0b0e0e0f, BUFFER_CREATED = 0x00beef00, - BUFFER_DESTROYED = 0x00dead00, + BUFFER_DESTROYED = 0x00dead00 } state; widget_target_type_e type; diff --git a/src/widget_service.c b/src/widget_service.c index 5eacdbc..1aeef1b 100644 --- a/src/widget_service.c +++ b/src/widget_service.c @@ -3225,12 +3225,13 @@ EAPI widget_lock_info_t widget_service_create_lock(const char *uri, widget_targe return NULL; } + info->state = LOCK_CREATED; return info; } EAPI int widget_service_destroy_lock(widget_lock_info_t info) { - if (!info || !info->filename || info->fd < 0) { + if (!info || info->state != LOCK_CREATED || !info->filename || info->fd < 0) { return WIDGET_ERROR_INVALID_PARAMETER; } @@ -3243,6 +3244,7 @@ EAPI int widget_service_destroy_lock(widget_lock_info_t info) ErrPrint("unlink: %s\n", strerror(errno)); } + info->state = LOCK_DESTROYED; free(info->filename); free(info); return WIDGET_ERROR_NONE; @@ -3253,7 +3255,7 @@ EAPI int widget_service_acquire_lock(widget_lock_info_t info) struct flock flock; int ret; - if (!info || info->fd < 0) { + if (!info || info->state != LOCK_CREATED || info->fd < 0) { return WIDGET_ERROR_INVALID_PARAMETER; } @@ -3283,7 +3285,7 @@ EAPI int widget_service_release_lock(widget_lock_info_t info) struct flock flock; int ret; - if (info->fd < 0) { + if (!info || info->state != LOCK_CREATED || info->fd < 0) { return WIDGET_ERROR_INVALID_PARAMETER; } |