-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy paththread.h
50 lines (39 loc) · 1.6 KB
/
thread.h
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
/*
* This file is part of mtrace-ng.
* Copyright (C) 2018 Stefani Seibold <stefani@seibold.net>
*
* This work was sponsored by Rohde & Schwarz GmbH & Co. KG, Munich/Germany.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef _INC_THREAD_H
#define _INC_THREAD_H
struct thread;
/* create a thread object */
struct thread *thread_new(void);
/* remove a thread object (wait if the thread is still running */
void thread_remove(struct thread *thread);
/* start a thread with the given start routine and the pass the give arg pointer */
int thread_start(struct thread *thread, void *(*start_routine)(void *), void *arg);
/* wait for termination of the thread */
void thread_join(struct thread *thread);
/* enable cancelation of the current running thread */
void thread_enable_cancel(void);
/* disable cancelation of the current running thread */
void thread_disable_cancel(void);
/* cancel thread */
void thread_cancel(struct thread *thread);
#endif