1 /* 2 * SPDX-License-Identifier: BSD-3-Clause 3 * Copyright 2015 Intel Corporation. 4 * Copyright 2012 Hasan Alayli <[email protected]> 5 */ 6 #ifndef LTHREAD_H_ 7 #define LTHREAD_H_ 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #include <rte_per_lcore.h> 14 15 #include "lthread_api.h" 16 #include "lthread_diag.h" 17 18 struct lthread; 19 struct lthread_sched; 20 21 /* function to be called when a context function returns */ 22 typedef void (*lthread_exit_func) (struct lthread *); 23 24 void _lthread_exit_handler(struct lthread *lt); 25 26 void lthread_set_funcname(const char *f); 27 28 void _lthread_sched_busy_sleep(struct lthread *lt, uint64_t nsecs); 29 30 int _lthread_desched_sleep(struct lthread *lt); 31 32 void _lthread_free(struct lthread *lt); 33 34 struct lthread_sched *_lthread_sched_get(unsigned int lcore_id); 35 36 struct lthread_stack *_stack_alloc(void); 37 38 struct 39 lthread_sched *_lthread_sched_create(size_t stack_size); 40 41 void 42 _lthread_init(struct lthread *lt, 43 lthread_func_t fun, void *arg, lthread_exit_func exit_handler); 44 45 void _lthread_set_stack(struct lthread *lt, void *stack, size_t stack_size); 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif /* LTHREAD_H_ */ 52