[FIX] sampling start when profiling has not started
authorAnastasia Lyupa <a.lyupa@samsung.com>
Thu, 24 Oct 2013 08:54:26 +0000 (12:54 +0400)
committerAnastasia Lyupa <a.lyupa@samsung.com>
Thu, 24 Oct 2013 08:54:26 +0000 (12:54 +0400)
Change-Id: I799bbefcd8e5d5b110dc77594540e46ac614ae73
Signed-off-by: Anastasia Lyupa <a.lyupa@samsung.com>
daemon/da_protocol.c
daemon/threads.c

index a403ba0..cc06545 100644 (file)
@@ -993,6 +993,8 @@ static int process_msg_start(struct msg_buf_t *msg_control)
                goto send_ack;
        }
 
+       running_status_on(&prof_session);
+
        if (start_profiling() < 0) {
                LOGE("cannot start profiling\n");
                if (stop_all() != ERR_NO) {
@@ -1003,7 +1005,6 @@ static int process_msg_start(struct msg_buf_t *msg_control)
        }
 
        err_code = ERR_NO;
-       running_status_on(&prof_session);
 send_ack:
        get_serialized_time(&serialized_time);
        sendACKToHost(NMSG_START, err_code, (void *)&serialized_time,
index 7482170..3c43d84 100644 (file)
@@ -301,6 +301,11 @@ int samplingStart()
        if(manager.sampling_thread != -1)       // already started
                return 1;
 
+       if (check_running_status(&prof_session) == 0) {
+               LOGI("try to start sampling when running_status is 0\n");
+               return 1;
+       }
+
        if(pthread_create(&(manager.sampling_thread), NULL, samplingThread, NULL) < 0)
        {
                LOGE("Failed to create sampling thread\n");