diff options
author | Sung-jae Park <nicesj.park@samsung.com> | 2013-04-23 08:59:57 +0900 |
---|---|---|
committer | Sung-jae Park <nicesj.park@samsung.com> | 2013-04-23 08:59:57 +0900 |
commit | 5f77e1b8426962ceb6696fc78b06a2c5fad57537 (patch) | |
tree | 39439e992f0375ec2d4429031409c88fec45d28c /include | |
parent | cc50a4eccfce0ef96156f3b49b3d33f8d1fdbb0f (diff) | |
download | data-provider-master-5f77e1b8426962ceb6696fc78b06a2c5fad57537.tar.gz data-provider-master-5f77e1b8426962ceb6696fc78b06a2c5fad57537.tar.bz2 data-provider-master-5f77e1b8426962ceb6696fc78b06a2c5fad57537.zip |
Implement the service threads.
Shortcut service thread is enabled.
Service connection method is updated
(using vconf to notify running state of the master.)
Change-Id: I92af0e2e693c4516b407263bfb1fae9a8925f83e
Diffstat (limited to 'include')
-rw-r--r-- | include/conf.h | 4 | ||||
-rw-r--r-- | include/service_common.h | 5 | ||||
-rw-r--r-- | include/shortcut_service.h | 3 | ||||
-rw-r--r-- | include/util.h | 44 |
4 files changed, 53 insertions, 3 deletions
diff --git a/include/conf.h b/include/conf.h index 87d1070..50a171b 100644 --- a/include/conf.h +++ b/include/conf.h @@ -155,6 +155,10 @@ extern int conf_loader(void); #define DEFAULT_CLUSTER "user,created" #define MINIMUM_REACTIVATION_TIME 10 +#if !defined(VCONFKEY_MASTER_STARTED) +#define VCONFKEY_MASTER_STARTED "memory/data-provider-master/started" +#endif + #define USE_XMONITOR g_conf.use_xmonitor #define HAPI __attribute__((visibility("hidden"))) diff --git a/include/service_common.h b/include/service_common.h index 6b0e4dd..fa0188c 100644 --- a/include/service_common.h +++ b/include/service_common.h @@ -14,9 +14,8 @@ * limitations under the License. */ enum tcb_type { - TCB_CLIENT_TYPE_UNDEFINED = 0x00, - TCB_CLIENT_TYPE_APP = 0x01, - TCB_CLIENT_TYPE_SERVICE = 0x02, + TCB_CLIENT_TYPE_APP = 0x00, + TCB_CLIENT_TYPE_SERVICE = 0x01, TCB_CLIENT_TYPE_UNKNOWN = 0xff, }; diff --git a/include/shortcut_service.h b/include/shortcut_service.h index a7a146d..65031a2 100644 --- a/include/shortcut_service.h +++ b/include/shortcut_service.h @@ -14,4 +14,7 @@ * limitations under the License. */ +extern int shortcut_service_init(void); +extern int shortcut_service_fini(void); + /* End of a file */ diff --git a/include/util.h b/include/util.h index a474c06..75e4715 100644 --- a/include/util.h +++ b/include/util.h @@ -34,4 +34,48 @@ extern double util_time_delay_for_compensation(double period); #define SCHEMA_PIXMAP "pixmap://" #define SCHEMA_SHM "shm://" +#define CRITICAL_SECTION_BEGIN(handle) \ +do { \ + int ret; \ + ret = pthread_mutex_lock(handle); \ + if (ret != 0) \ + ErrPrint("Failed to lock: %s\n", strerror(ret)); \ +} while (0) + +#define CRITICAL_SECTION_END(handle) \ +do { \ + int ret; \ + ret = pthread_mutex_unlock(handle); \ + if (ret != 0) \ + ErrPrint("Failed to unlock: %s\n", strerror(ret)); \ +} while (0) + +#define CANCEL_SECTION_BEGIN() do { \ + int ret; \ + ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); \ + if (ret != 0) \ + ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \ +} while (0) + +#define CANCEL_SECTION_END() do { \ + int ret; \ + ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); \ + if (ret != 0) \ + ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \ +} while (0) + +#define CLOSE_PIPE(p) do { \ + int status; \ + status = close(p[PIPE_READ]); \ + if (status < 0) \ + ErrPrint("close: %s\n", strerror(errno)); \ + status = close(p[PIPE_WRITE]); \ + if (status < 0) \ + ErrPrint("close: %s\n", strerror(errno)); \ +} while (0) + +#define PIPE_READ 0 +#define PIPE_WRITE 1 +#define PIPE_MAX 2 + /* End of a file */ |