From: IJsbrand Wijnands Date: Tue, 8 Oct 2019 11:50:55 +0000 (+0200) Subject: api: add bapi thread handle to api main structure. X-Git-Tag: v20.05-rc0~681 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F22608%2F1;p=vpp.git api: add bapi thread handle to api main structure. Adding the thread handle to the api main structure allows the client process of the bin api to manage the thread, like setting the thread name for example. Type: feature Change-Id: I38b58ddc83d5958c4bda76eadd371eee1545724b Signed-off-by: IJsbrand Wijnands --- diff --git a/src/vlibapi/api_common.h b/src/vlibapi/api_common.h index 98fcbdefef9..bb1997041f4 100644 --- a/src/vlibapi/api_common.h +++ b/src/vlibapi/api_common.h @@ -340,6 +340,9 @@ typedef struct /** List of API client reaper functions */ _vl_msg_api_function_list_elt_t *reaper_function_registrations; + /** Bin API thread handle */ + pthread_t rx_thread_handle; + /** event log */ elog_main_t *elog_main; int elog_trace_api_messages; diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c index f032ae77d19..25c01f18e80 100644 --- a/src/vlibmemory/memory_client.c +++ b/src/vlibmemory/memory_client.c @@ -394,6 +394,7 @@ connect_to_vlib_internal (const char *svm_name, { int rv = 0; memory_client_main_t *mm = &memory_client_main; + api_main_t *am = &api_main; if (do_map && (rv = vl_client_api_map (svm_name))) { @@ -415,7 +416,14 @@ connect_to_vlib_internal (const char *svm_name, rv = pthread_create (&mm->rx_thread_handle, NULL /*attr */ , rx_thread_fn, 0); if (rv) - clib_warning ("pthread_create returned %d", rv); + { + clib_warning ("pthread_create returned %d", rv); + am->rx_thread_handle = 0; + } + else + { + am->rx_thread_handle = mm->rx_thread_handle; + } } mm->connected_to_vlib = 1;