rllib
1
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
lib
rlwthread.h
Go to the documentation of this file.
1
/***************************************************************************
2
wthread.h - description
3
-------------------
4
begin : Sun Jan 02 2000
5
copyright : (C) 2001 by R. Lehrig
6
email : lehrig@t-online.de
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This library is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as *
13
* published by the Free Software Foundation *
14
* *
15
***************************************************************************/
16
/***********************************************************************************
17
18
Wrapper for posix threads (UNIX,VMS,windows)
19
20
(C) R. Lehrig 2001 lehrig@t-online.de
21
22
***********************************************************************************/
23
24
#ifndef _RL_WTHREAD_H_
25
#define _RL_WTHREAD_H_
26
27
#ifndef SWIG
28
29
#include "
rldefine.h
"
30
31
#ifdef RLWIN32
32
33
#include <windows.h>
34
#include <winbase.h>
35
#include <stddef.h>
36
#include <string.h>
37
38
#ifndef _WRAPTHREAD_
39
#ifndef _WTHREAD_H_
40
typedef
unsigned
long
int
pthread_t
;
41
42
/* Attributes for threads */
43
typedef
struct
__sched_param
44
{
45
int
sched_priority
;
46
}
SCHED_PARAM
;
47
48
typedef
struct
49
{
50
int
__detachstate
;
51
int
__schedpolicy
;
52
struct
__sched_param
__schedparam;
53
int
__inheritsched
;
54
int
__scope
;
55
size_t
__guardsize
;
56
int
__stackaddr_set
;
57
void
*
__stackaddr
;
58
size_t
__stacksize
;
59
}
pthread_attr_t
;
60
61
typedef
HANDLE
pthread_mutex_t
;
62
//old typedef CRITICAL_SECTION pthread_mutex_t;
63
typedef
long
pthread_mutexattr_t
;
64
#endif
65
#endif
66
67
#else
/* VMS or UNIX */
68
#include <pthread.h>
69
#endif
/* end of MSWINDOWS */
70
71
#ifndef _WRAPTHREAD_
72
#ifndef _WTHREAD_H_
73
typedef
struct
74
{
75
#ifdef RLWIN32
76
int
cmax
;
77
HANDLE
hSemaphore
;
78
#else
79
int
cmax;
80
int
nready;
81
pthread_mutex_t
mutex;
82
pthread_cond_t cond;
83
#endif
84
}
WSEMAPHORE
;
85
#endif
86
#endif
87
88
/* function prototypes */
89
//#ifdef __cplusplus
90
//extern "C" {
91
//#endif
92
int
rlwthread_attr_init
(
pthread_attr_t
*attr);
93
int
rlwthread_create
(
pthread_t
*tid,
const
pthread_attr_t
*attr,
94
void
*(*func)(
void
*),
void
*arg);
95
void
rlwthread_close_handle
(
pthread_t
*tid);
96
void
rlwthread_exit
(
void
*status);
97
int
rlwthread_join
(
pthread_t
tid,
void
**status);
98
int
rlwthread_mutex_init
(
pthread_mutex_t
*mptr,
const
pthread_mutexattr_t
*attr);
99
int
rlwthread_mutex_destroy
(
pthread_mutex_t
*mptr);
100
int
rlwthread_mutex_lock
(
pthread_mutex_t
*mptr);
101
int
rlwthread_mutex_trylock
(
pthread_mutex_t
*mptr);
102
int
rlwthread_mutex_unlock
(
pthread_mutex_t
*mptr);
103
int
rlwthread_cancel
(
pthread_t
tid);
104
int
rlwrapinit_semaphore
(
WSEMAPHORE
*s,
int
cmax);
105
int
rlwrapdestroy_semaphore
(
WSEMAPHORE
*s);
106
int
rlwrapincrement_semaphore
(
WSEMAPHORE
*s);
107
int
rlwrapwait_semaphore
(
WSEMAPHORE
*s);
108
int
rlwthread_sleep
(
long
msec);
109
void
rlsleep
(
long
msec);
110
//#ifdef __cplusplus
111
//};
112
//#endif
113
114
#else
115
// SWIG
116
void
rlsleep
(
long
msec);
117
#endif
118
119
#endif
Generated by
1.8.2