aboutsummaryrefslogtreecommitdiffstats
path: root/examples/performance-thread/common/lthread.h
blob: 4c945cf76a3a62874051a988073567af65c01139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * SPDX-License-Identifier: BSD-3-Clause
 * Copyright 2015 Intel Corporation.
 * Copyright 2012 Hasan Alayli <halayli@gmail.com>
 */
#ifndef LTHREAD_H_
#define LTHREAD_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <rte_per_lcore.h>

#include "lthread_api.h"
#include "lthread_diag.h"

struct lthread;
struct lthread_sched;

/* function to be called when a context function returns */
typedef void (*lthread_exit_func) (struct lthread *);

void _lthread_exit_handler(struct lthread *lt);

void lthread_set_funcname(const char *f);

void _lthread_sched_busy_sleep(struct lthread *lt, uint64_t nsecs);

int _lthread_desched_sleep(struct lthread *lt);

void _lthread_free(struct lthread *lt);

struct lthread_sched *_lthread_sched_get(unsigned int lcore_id);

struct lthread_stack *_stack_alloc(void);

struct
lthread_sched *_lthread_sched_create(size_t stack_size);

void
_lthread_init(struct lthread *lt,
	      lthread_func_t fun, void *arg, lthread_exit_func exit_handler);

void _lthread_set_stack(struct lthread *lt, void *stack, size_t stack_size);

#ifdef __cplusplus
}
#endif

#endif				/* LTHREAD_H_ */