lib60870-C  2.3.2
C source code library for the IEC 60870-5-101/104 protocols
hal_thread.h
Go to the documentation of this file.
1 /*
2  * thread_hal.h
3  *
4  * Multi-threading abstraction layer
5  *
6  * Copyright 2013-2021 Michael Zillgith
7  *
8  * This file is part of Platform Abstraction Layer (libpal)
9  * for libiec61850, libmms, and lib60870.
10  */
11 
12 #ifndef THREAD_HAL_H_
13 #define THREAD_HAL_H_
14 
15 #include "hal_base.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
38 typedef struct sThread* Thread;
39 
41 typedef void* Semaphore;
42 
44 typedef void* (*ThreadExecutionFunction) (void*);
45 
55 PAL_API Thread
56 Thread_create(ThreadExecutionFunction function, void* parameter, bool autodestroy);
57 
66 PAL_API void
68 
74 PAL_API void
76 
80 PAL_API void
81 Thread_sleep(int millies);
82 
83 PAL_API Semaphore
84 Semaphore_create(int initialValue);
85 
86 /* Wait until semaphore value is greater than zero. Then decrease the semaphore value. */
87 PAL_API void
88 Semaphore_wait(Semaphore self);
89 
90 PAL_API void
91 Semaphore_post(Semaphore self);
92 
93 PAL_API void
94 Semaphore_destroy(Semaphore self);
95 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 
105 #endif /* THREAD_HAL_H_ */
PAL_API Thread Thread_create(ThreadExecutionFunction function, void *parameter, bool autodestroy)
Create a new Thread instance.
PAL_API void Thread_destroy(Thread thread)
Destroy a Thread and free all related resources.
struct sThread * Thread
Definition: hal_thread.h:38
void * Semaphore
Definition: hal_thread.h:41
PAL_API void Thread_start(Thread thread)
Start a Thread.
void *(* ThreadExecutionFunction)(void *)
Definition: hal_thread.h:44
PAL_API void Thread_sleep(int millies)
Suspend execution of the Thread for the specified number of milliseconds.