mbtk: fix api 卡死

Change-Id: I6e216caa36f2419ac70883e4c3ef2ed16999864a
diff --git a/mbtk/mbtk_lib/src/mbtk_info_api.c b/mbtk/mbtk_lib/src/mbtk_info_api.c
index 6472ea0..1dafe64 100755
--- a/mbtk/mbtk_lib/src/mbtk_info_api.c
+++ b/mbtk/mbtk_lib/src/mbtk_info_api.c
@@ -396,6 +396,11 @@
         pack->data_len = (uint16)send_buff_len;
         pack->data = (const uint8*)send_buff;
     }
+
+    pthread_mutex_lock(&handle->send_mutex);
+    pthread_mutex_lock(&handle->mutex);
+    handle->is_waitting = true;
+    
     mbtk_info_pack_send(handle->client_fd, pack);
     mbtk_info_pack_free(&pack);
 
@@ -403,8 +408,6 @@
         handle->data = recv_buff;
 
     // Wait for server response.
-    pthread_mutex_lock(&handle->mutex);
-    handle->is_waitting = true;
     pthread_cond_wait(&handle->cond, &handle->mutex);
     handle->is_waitting = false;
     pthread_mutex_unlock(&handle->mutex);
@@ -418,9 +421,11 @@
             handle->data_len = 0;
             handle->data = NULL;
         }
+        pthread_mutex_unlock(&handle->send_mutex);
         return recv_len;
     } else {
         LOG("REQ %s fail : %s", id2str(id), err2str(handle->info_err));
+        pthread_mutex_unlock(&handle->send_mutex);
         return -1;
     }
 }
@@ -495,6 +500,7 @@
 #endif
 
     pthread_mutex_init(&handle->mutex, NULL);
+    pthread_mutex_init(&handle->send_mutex, NULL);
     pthread_cond_init(&handle->cond, NULL);
     handle->is_waitting = false;