Fix gnss thread exit.
Change-Id: I534e703ea4a7f0f4a57ffa3da7ac226c149b0a3f
diff --git a/mbtk/mbtk_gnssd/gnss_main.c b/mbtk/mbtk_gnssd/gnss_main.c
index a20b75e..49adf98 100755
--- a/mbtk/mbtk_gnssd/gnss_main.c
+++ b/mbtk/mbtk_gnssd/gnss_main.c
@@ -413,6 +413,20 @@
while(gnss_info.state >= GNSS_STATE_OPEN) {
ret = select(fd_max + 1, &fdr, &fdw, 0, NULL);
//LOGD("select - %d", ret);
+ if(gnss_info.state < GNSS_STATE_OPEN) {
+ LOGD("State = %d, ret = %d", gnss_info.state, ret);
+ if(ret > 0) {
+ if (FD_ISSET(gnss_info.fd, &fdr)) {
+ LOGD("gnss_fd can read.");
+ } else if (FD_ISSET(gnss_info.exit_fd[0], &fdr)) {
+ LOGD("exit_fd can read.");
+ } else {
+ LOGW("Unknown select event.");
+ }
+ }
+ break;
+ }
+
if (ret < 0)
{
if (errno == EINTR)
@@ -457,6 +471,7 @@
}
else if (FD_ISSET(gnss_info.exit_fd[0], &fdr))
{
+ LOGD("exit_fd select event.");
memset(buffer, 0, GNSS_BUFF_SIZE);
len = read(gnss_info.exit_fd[0], buffer, GNSS_BUFF_SIZE);
if(len > 0) {