Skip to main content
summaryrefslogtreecommitdiffstats
blob: e98874e0e837e815dca3fee90124e2985e494468 (plain) (blame)
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
52
53
54
55
56
/*******************************************************************************
 * Copyright (c) 2011 Wind River Systems, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v1.0 which accompany this distribution.
 * The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 * You may elect to redistribute this code under either of these licenses.
 *
 * Contributors:
 *     Wind River Systems - initial API and implementation
 *******************************************************************************/

/*
 * PThreads emulation for Windows.
 */

#ifndef D_pthreads_win32
#define D_pthreads_win32

#if defined(__CYGWIN__)
#  include <cygwin/types.h>
#else
typedef struct pthread_struct * pthread_t;
typedef struct pthread_attr_struct * pthread_attr_t;
typedef struct pthread_mutex_struct * pthread_mutex_t;
typedef struct pthread_cond_struct * pthread_cond_t;
typedef struct pthread_mutexattr_struct * pthread_mutexattr_t;
typedef struct pthread_condattr_struct * pthread_condattr_t;
#endif

extern int pthread_attr_init(pthread_attr_t * attr);

extern int pthread_cond_init(pthread_cond_t * cond, const pthread_condattr_t * attr);
extern int pthread_cond_signal(pthread_cond_t * cond);
extern int pthread_cond_broadcast(pthread_cond_t * cond);
extern int pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex);
extern int pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,
                                  const struct timespec * abstime);
extern int pthread_cond_destroy(pthread_cond_t * cond);

extern int pthread_mutex_init(pthread_mutex_t * mutex, const pthread_mutexattr_t * attr);
extern int pthread_mutex_lock(pthread_mutex_t * mutex);
extern int pthread_mutex_unlock(pthread_mutex_t * mutex);
extern int pthread_mutex_destroy(pthread_mutex_t *mutex);

extern pthread_t pthread_self(void);
extern int pthread_create(pthread_t * thread, const pthread_attr_t * attr,
                          void * (*start_routine)(void *), void * arg);
extern int pthread_join(pthread_t thread, void **value_ptr);
extern int pthread_detach(pthread_t thread);
extern int pthread_equal(pthread_t thread1, pthread_t thread2);

#endif /* D_pthreads_win32 */

Back to the top