commit
faed5745e11faec2a6107eda7b036b8682c4e952
Author: Sung-jae Park <nicesj.park@samsung.com>
Date: Fri Apr 18 14:03:53 2014 +0900
Change the app-name
commit
2735c957022c72d376ea885d8dcb187781bb0fd2
Author: Sung-jae Park <nicesj.park@samsung.com>
Date: Fri Apr 18 11:36:27 2014 +0900
Update the deleted/updated callback call routine.
While processing the updated/deleted callback, any item can be deleted.
Using in_use flag, if there is deleting request while processing callback list,
don't delete item directly just toggle the deleted flag.
After callback call, check the deleted flag. if the deleted flag is toggled,
Then delete it from the list safely.
Change-Id: I01fcbecb11aa6147c57a47143753a6f9d65f78f1
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.data-provider-slave" version="0.5.4" install-location="auto">
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.data-provider-slave" version="0.5.4" install-location="auto">
- <label>Dynamic Box Provider (Default)</label>
+ <label>Dynamic Box Provider (slave)</label>
<author email="nicesj.park@samsung.com" href="www.samsung.com">Sung-jae Park</author>
<author email="yjoo93.park@samsung.com" href="www.samsung.com">Youngjoo Park</author>
<author email="nicesj.park@samsung.com" href="www.samsung.com">Sung-jae Park</author>
<author email="yjoo93.park@samsung.com" href="www.samsung.com">Youngjoo Park</author>
- <description>Dynamic Box Provider (Default)</description>
+ <description>Dynamic Box Provider (slave)</description>
<ui-application appid="org.tizen.data-provider-slave" exec="/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave" nodisplay="true" multiple="true" type="capp" taskmanage="false">
<icon>org.tizen.data-provider-slave.png</icon>
<label>Dynamic Box Provider (Default)</label>
<ui-application appid="org.tizen.data-provider-slave" exec="/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave" nodisplay="true" multiple="true" type="capp" taskmanage="false">
<icon>org.tizen.data-provider-slave.png</icon>
<label>Dynamic Box Provider (Default)</label>
- <label xml:lang="en-us">Dynamic Box Provider (Default)</label>
+ <label xml:lang="en-us">Dynamic Box Provider (slave)</label>
</ui-application>
<ui-application appid="org.tizen.data-provider-slave.icon" exec="/usr/apps/org.tizen.data-provider-slave/bin/icon-provider-slave" nodisplay="true" multiple="false" type="capp" taskmanage="false">
</ui-application>
<ui-application appid="org.tizen.data-provider-slave.icon" exec="/usr/apps/org.tizen.data-provider-slave/bin/icon-provider-slave" nodisplay="true" multiple="false" type="capp" taskmanage="false">
Name: org.tizen.data-provider-slave
Summary: Plugin type livebox service provider
Name: org.tizen.data-provider-slave
Summary: Plugin type livebox service provider
Release: 1
Group: HomeTF/Livebox
License: Flora
Release: 1
Group: HomeTF/Livebox
License: Flora
+ if (item->deleteme) {
+ DbgPrint("Item is in deleting process. (%s)\n", filename);
+ goto out;
+ }
+
ESTIMATE_START(item->inst->id);
ret = util_get_filesize(filename);
ESTIMATE_START(item->inst->id);
ret = util_get_filesize(filename);
}
ESTIMATE_END(item->inst->id);
}
ESTIMATE_END(item->inst->id);
return output_handler(item);
}
return output_handler(item);
}
char *filename;
int (*cb)(const char *filename, void *data, int over);
void *data;
char *filename;
int (*cb)(const char *filename, void *data, int over);
void *data;
Ecore_Fd_Handler *handler;
Eina_List *update_list;
Eina_List *delete_list;
Ecore_Fd_Handler *handler;
Eina_List *update_list;
Eina_List *delete_list;
+ unsigned int update_list_in_use;
+ unsigned int delete_list_in_use;
} s_info = {
.ifd = -EINVAL,
.iwd = -EINVAL,
.handler = NULL,
.update_list = NULL,
.delete_list = NULL,
} s_info = {
.ifd = -EINVAL,
.iwd = -EINVAL,
.handler = NULL,
.update_list = NULL,
.delete_list = NULL,
+ .update_list_in_use = 0,
+ .delete_list_in_use = 0,
+static void *update_item_destroy(struct cb_item *item, Eina_List *l)
+{
+ void *data;
+
+ if (s_info.update_list_in_use) {
+ item->deleted = 1;
+ data = item->data;
+ } else {
+ s_info.update_list = eina_list_remove_list(s_info.update_list, l);
+ data = item->data;
+ free(item->filename);
+ free(item);
+ }
+
+ return data;
+}
+
+static void *delete_item_destroy(struct cb_item *item, Eina_List *l)
+{
+ void *data;
+
+ if (s_info.delete_list_in_use == 1) {
+ item->deleted = 1;
+ data = item->data;
+ } else {
+ s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
+ data = item->data;
+ free(item->filename);
+ free(item);
+ }
+
+ return data;
+}
+
static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
{
int fd;
static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
{
int fd;
struct cb_item *item;
int cnt = 0;
struct cb_item *item;
int cnt = 0;
+ s_info.update_list_in_use = 1;
EINA_LIST_FOREACH_SAFE(s_info.update_list, l, n, item) {
EINA_LIST_FOREACH_SAFE(s_info.update_list, l, n, item) {
- if (!strcmp(filename, item->filename) && item->cb(filename, item->data, over) == EXIT_FAILURE) {
- /* Item can be deleted from the callback, so need to check existence */
- if (eina_list_data_find(s_info.update_list, item)) {
+ if (!strcmp(filename, item->filename)) {
+ if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
+ /* Item can be deleted from the callback, so need to check existence */
s_info.update_list = eina_list_remove_list(s_info.update_list, l);
free(item->filename);
free(item);
s_info.update_list = eina_list_remove_list(s_info.update_list, l);
free(item->filename);
free(item);
+ s_info.update_list_in_use = 0;
return cnt == 0 ? LB_STATUS_ERROR_INVALID : LB_STATUS_SUCCESS;
}
return cnt == 0 ? LB_STATUS_ERROR_INVALID : LB_STATUS_SUCCESS;
}
struct cb_item *item;
int cnt = 0;
struct cb_item *item;
int cnt = 0;
+ s_info.delete_list_in_use = 1;
EINA_LIST_FOREACH_SAFE(s_info.delete_list, l, n, item) {
EINA_LIST_FOREACH_SAFE(s_info.delete_list, l, n, item) {
- if (!strcmp(filename, item->filename) && item->cb(filename, item->data, over) == EXIT_FAILURE) {
- /* Item can be deleted from the callback, so need to check existence. */
- if (eina_list_data_find(s_info.delete_list, item)) {
+ if (!strcmp(filename, item->filename)) {
+ /* delete should be checked before call the callback & after call the callback */
+ if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
free(item->filename);
free(item);
}
s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
free(item->filename);
free(item);
}
+ s_info.delete_list_in_use = 0;
return cnt == 0 ? LB_STATUS_ERROR_INVALID : LB_STATUS_SUCCESS;
}
return cnt == 0 ? LB_STATUS_ERROR_INVALID : LB_STATUS_SUCCESS;
}
{
Eina_List *l;
struct cb_item *item;
{
Eina_List *l;
struct cb_item *item;
EINA_LIST_FOREACH(s_info.update_list, l, item) {
if (item->cb == cb && !strcmp(item->filename, filename)) {
EINA_LIST_FOREACH(s_info.update_list, l, item) {
if (item->cb == cb && !strcmp(item->filename, filename)) {
- s_info.update_list = eina_list_remove_list(s_info.update_list, l);
- data = item->data;
- free(item->filename);
- free(item);
- return data;
+ return update_item_destroy(item, l);
{
Eina_List *l;
struct cb_item *item;
{
Eina_List *l;
struct cb_item *item;
EINA_LIST_FOREACH(s_info.delete_list, l, item) {
if (item->cb == cb && !strcmp(item->filename, filename)) {
EINA_LIST_FOREACH(s_info.delete_list, l, item) {
if (item->cb == cb && !strcmp(item->filename, filename)) {
- s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
- data = item->data;
- free(item->filename);
- free(item);
- return data;
+ return delete_item_destroy(item, l);