3
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef _SEMA_H_
|
|
22 |
#define _SEMA_H_
|
|
23 |
|
|
24 |
#ifdef WIN32
|
|
25 |
#include <windows.h>
|
|
26 |
#include <tlhelp32.h>
|
|
27 |
#else
|
|
28 |
#include <semaphore.h>
|
|
29 |
#include <sys/types.h>
|
|
30 |
#endif
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
typedef struct
|
|
35 |
{
|
|
36 |
char *name;
|
|
37 |
#ifdef WIN32
|
|
38 |
HANDLE handle;
|
|
39 |
#else
|
|
40 |
sem_t *handle;
|
|
41 |
#endif
|
|
42 |
unsigned int timeout;
|
|
43 |
} sbs_semaphore;
|
|
44 |
|
|
45 |
|
|
46 |
void sema_create(sbs_semaphore *s);
|
|
47 |
void sema_destroy(sbs_semaphore *s);
|
|
48 |
int sema_wait(sbs_semaphore *s);
|
|
49 |
void sema_release(sbs_semaphore *s);
|
|
50 |
int sema_wait(sbs_semaphore *s);
|
|
51 |
|
|
52 |
#endif
|