eal: add function to create control threads
[dpdk.git] / lib / librte_eal / common / eal_common_proc.c
index f8cb0e8..abaa085 100644 (file)
@@ -419,7 +419,13 @@ process_async_request(struct pending_request *sr, const struct timespec *now)
        } else if (sr->reply_received == -1) {
                /* we were asked to ignore this process */
                reply->nb_sent--;
+       } else if (timeout) {
+               /* count it as processed response, but don't increment
+                * nb_received.
+                */
+               param->n_responses_processed++;
        }
+
        free(sr->reply);
 
        last_msg = param->n_responses_processed == reply->nb_sent;
@@ -656,7 +662,7 @@ rte_mp_channel_init(void)
                return -1;
        }
 
-       if (pthread_create(&mp_handle_tid, NULL, mp_handle, NULL) < 0) {
+       if (rte_ctrl_thread_create(&mp_handle_tid, NULL, mp_handle, NULL) < 0) {
                RTE_LOG(ERR, EAL, "failed to create mp thead: %s\n",
                        strerror(errno));
                close(mp_fd);
@@ -665,7 +671,7 @@ rte_mp_channel_init(void)
                return -1;
        }
 
-       if (pthread_create(&async_reply_handle_tid, NULL,
+       if (rte_ctrl_thread_create(&async_reply_handle_tid, NULL,
                        async_reply_handle, NULL) < 0) {
                RTE_LOG(ERR, EAL, "failed to create mp thead: %s\n",
                        strerror(errno));
@@ -676,11 +682,11 @@ rte_mp_channel_init(void)
        }
 
        /* try best to set thread name */
-       strlcpy(thread_name, "rte_mp_handle", RTE_MAX_THREAD_NAME_LEN);
+       strlcpy(thread_name, "rte_mp_handle", sizeof(thread_name));
        rte_thread_setname(mp_handle_tid, thread_name);
 
        /* try best to set thread name */
-       strlcpy(thread_name, "rte_mp_async_handle", RTE_MAX_THREAD_NAME_LEN);
+       strlcpy(thread_name, "rte_mp_async_handle", sizeof(thread_name));
        rte_thread_setname(async_reply_handle_tid, thread_name);
 
        /* unlock the directory */