Add use_thread parameter.
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 19 Dec 2013 05:16:23 +0000 (14:16 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 19 Dec 2013 05:16:23 +0000 (14:16 +0900)
Client should be able to select the thread mode.
If the use_thread = 1, the com-core will fork a new thread for getting the packet from the socket.
So the socket buffer always be empty.

Change-Id: I7a83f4de807dd5d7310d66dd46684887636189ef

include/client.h
include/livebox.h
packaging/liblivebox-viewer.spec
src/client.c
src/livebox.c

index e0348d4..db8a931 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-extern int client_init(void);
+extern int client_init(int use_thread);
 extern int client_fd(void);
 extern const char *client_addr(void);
 extern int client_fini(void);
index 5b11e7f..3463d62 100644 (file)
@@ -284,6 +284,7 @@ typedef void (*ret_cb_t)(struct livebox *handle, int ret, void *data);
  * \pre N/A
  * \post N/A
  * \see livebox_fini
+ * \see livebox_init_with_options
  */
 extern int livebox_init(void *disp);
 
@@ -296,6 +297,7 @@ extern int livebox_init(void *disp);
  * \param[in] disp
  * \param[in] prevent_overwrite
  * \param[in] event_filter
+ * \param[in] use_thread Use the receive thread
  * \return int
  * \retval LB_STATUS_SUCCESS if success
  * \pre N/A
@@ -303,7 +305,7 @@ extern int livebox_init(void *disp);
  * \see livebox_init
  * \see livebox_fini
  */
-extern int livebox_init_with_options(void *disp, int prevent_overwrite, double event_filter);
+extern int livebox_init_with_options(void *disp, int prevent_overwrite, double event_filter, int use_thread);
 
 /*!
  * \brief Finalize the livebox system
@@ -315,6 +317,7 @@ extern int livebox_init_with_options(void *disp, int prevent_overwrite, double e
  * \pre N/A
  * \post N/A
  * \see livebox_init
+ * \see livebox_init_with_options
  */
 extern int livebox_fini(void);
 
index 3dc9344..c9d6270 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-viewer
-Summary: Library for developing the application.
-Version: 0.18.0
+Summary: Library for developing the application
+Version: 0.18.1
 Release: 1
 Group: HomeTF/Livebox
 License: Flora
index f862292..7bdf69d 100644 (file)
@@ -1480,8 +1480,10 @@ static int disconnected_cb(int handle, void *data)
        return 0;
 }
 
-int client_init(void)
+int client_init(int use_thread)
 {
+       com_core_packet_use_thread(use_thread);
+
        s_info.client_addr = vconf_get_str(VCONFKEY_MASTER_CLIENT_ADDR);
        if (!s_info.client_addr) {
                s_info.client_addr = strdup(CLIENT_SOCKET);
index 15197a0..3ed6ac0 100644 (file)
@@ -667,7 +667,7 @@ static int send_mouse_event(struct livebox *handler, const char *event, int x, i
        return master_rpc_request_only(handler, packet);
 }
 
-static void initialize_livebox(void *disp)
+static void initialize_livebox(void *disp, int use_thread)
 {
 #if defined(FLOG)
        char filename[BUFSIZ];
@@ -680,12 +680,12 @@ static void initialize_livebox(void *disp)
        livebox_service_init();
        fb_init(disp);
 
-       client_init();
+       client_init(use_thread);
 
        s_info.init_count++;
 }
 
-EAPI int livebox_init_with_options(void *disp, int prevent_overwrite, double event_filter)
+EAPI int livebox_init_with_options(void *disp, int prevent_overwrite, double event_filter, int use_thread)
 {
        if (s_info.init_count > 0) {
                s_info.init_count++;
@@ -700,7 +700,7 @@ EAPI int livebox_init_with_options(void *disp, int prevent_overwrite, double eve
        s_info.prevent_overwrite = prevent_overwrite;
        MINIMUM_EVENT = event_filter;
 
-       initialize_livebox(disp);
+       initialize_livebox(disp, use_thread);
        return LB_STATUS_SUCCESS;
 }
 
@@ -723,7 +723,7 @@ EAPI int livebox_init(void *disp)
                sscanf(env, "%lf", &MINIMUM_EVENT);
        }
 
-       initialize_livebox(disp);
+       initialize_livebox(disp, 0);
        return LB_STATUS_SUCCESS;
 }