Type: fix
Change-Id: Ib8313e87a89c80045edd897924917a88b98d1937
Signed-off-by: Florin Coras <fcoras@cisco.com>
+always_inline void
+vlibapi_set_main (api_main_t * am)
+{
+ my_api_main = am;
+}
+
#endif /* included_api_common_h */
/*
#endif /* included_api_common_h */
/*
memory_client_main_t memory_client_main;
__thread memory_client_main_t *my_memory_client_main = &memory_client_main;
memory_client_main_t memory_client_main;
__thread memory_client_main_t *my_memory_client_main = &memory_client_main;
+typedef struct rx_thread_fn_arg
+{
+ api_main_t *am;
+ memory_client_main_t *mm;
+} rx_thread_fn_arg_t;
+
static void *
rx_thread_fn (void *arg)
{
static void *
rx_thread_fn (void *arg)
{
+ rx_thread_fn_arg_t *a = (rx_thread_fn_arg_t *) arg;
+ memory_client_main_t *mm;
- memory_client_main_t *mm = vlibapi_get_memory_client_main ();
+ vlibapi_set_main (a->am);
+ vlibapi_set_memory_client_main (a->mm);
+ clib_mem_free (a);
+
+ mm = vlibapi_get_memory_client_main ();
q = vlibapi_get_main ()->vl_input_queue;
/* So we can make the rx thread terminate cleanly */
q = vlibapi_get_main ()->vl_input_queue;
/* So we can make the rx thread terminate cleanly */
+ if (thread_fn == rx_thread_fn)
+ {
+ rx_thread_fn_arg_t *arg;
+ arg = clib_mem_alloc (sizeof (*arg));
+ arg->am = vlibapi_get_main ();
+ arg->mm = vlibapi_get_memory_client_main ();
+ thread_fn_arg = (void *) arg;
+ }
+
rv = pthread_create (&mm->rx_thread_handle,
NULL /*attr */ , thread_fn, thread_fn_arg);
if (rv)
rv = pthread_create (&mm->rx_thread_handle,
NULL /*attr */ , thread_fn, thread_fn_arg);
if (rv)
return my_memory_client_main;
}
return my_memory_client_main;
}
+always_inline void
+vlibapi_set_memory_client_main (memory_client_main_t * mm)
+{
+ my_memory_client_main = mm;
+}
+
#endif /* SRC_VLIBMEMORY_MEMORY_CLIENT_H_ */
/*
#endif /* SRC_VLIBMEMORY_MEMORY_CLIENT_H_ */
/*