110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
1 |
/*
|
2 |
* Copyright (c) 2006 Ondrej Palkovsky
|
|
3 |
* All rights reserved.
|
|
4 |
*
|
|
5 |
* Redistribution and use in source and binary forms, with or without
|
|
6 |
* modification, are permitted provided that the following conditions
|
|
7 |
* are met:
|
|
8 |
*
|
|
9 |
* - Redistributions of source code must retain the above copyright
|
|
10 |
* notice, this list of conditions and the following disclaimer.
|
|
11 |
* - Redistributions in binary form must reproduce the above copyright
|
|
12 |
* notice, this list of conditions and the following disclaimer in the
|
|
13 |
* documentation and/or other materials provided with the distribution.
|
|
14 |
* - The name of the author may not be used to endorse or promote products
|
|
15 |
* derived from this software without specific prior written permission.
|
|
16 |
*
|
|
17 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
18 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
19 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
20 |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
21 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
22 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
23 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
24 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
26 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27 |
*/
|
|
28 |
||
29 |
/** @addtogroup libc
|
|
30 |
* @{
|
|
31 |
*/
|
|
32 |
/** @file
|
|
33 |
*/
|
|
34 |
||
538.1.301
by Martin Decky
introduce private libc.h header containing items which should not be visible from outside |
35 |
#ifndef LIBC_PRIVATE_ASYNC_H_
|
36 |
#define LIBC_PRIVATE_ASYNC_H_
|
|
110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
37 |
|
538.1.632
by Martin Decky
make async_sess_t and async_exch_t structures private |
38 |
#include <async.h> |
110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
39 |
#include <adt/list.h> |
40 |
#include <fibril.h> |
|
538.1.632
by Martin Decky
make async_sess_t and async_exch_t structures private |
41 |
#include <fibril_synch.h> |
110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
42 |
#include <sys/time.h> |
43 |
#include <bool.h> |
|
44 |
||
110.1.3
by Jakub Jermar
Separate timeout-specific wait data from generic wait data in awaiter_t. |
45 |
/** Structures of this type are used to track the timeout events. */
|
110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
46 |
typedef struct { |
47 |
/** If true, this struct is in the timeout list. */
|
|
48 |
bool inlist; |
|
49 |
||
50 |
/** Timeout list link. */
|
|
51 |
link_t link; |
|
52 |
||
110.1.3
by Jakub Jermar
Separate timeout-specific wait data from generic wait data in awaiter_t. |
53 |
/** If true, we have timed out. */
|
54 |
bool occurred; |
|
538.1.300
by Martin Decky
make the libc private header really private (i.e. do not allow to be included from outside the library easily) |
55 |
|
110.1.3
by Jakub Jermar
Separate timeout-specific wait data from generic wait data in awaiter_t. |
56 |
/** Expiration time. */
|
57 |
struct timeval expires; |
|
58 |
} to_event_t; |
|
59 |
||
110.1.5
by Jakub Jermar
Experimental support for timeoutable fibril condition variables. |
60 |
/** Structures of this type are used to track the wakeup events. */
|
61 |
typedef struct { |
|
62 |
/** If true, this struct is in a synchronization object wait queue. */
|
|
63 |
bool inlist; |
|
64 |
||
65 |
/** Wait queue linkage. */
|
|
66 |
link_t link; |
|
67 |
} wu_event_t; |
|
68 |
||
110.1.3
by Jakub Jermar
Separate timeout-specific wait data from generic wait data in awaiter_t. |
69 |
/** Structures of this type represent a waiting fibril. */
|
70 |
typedef struct { |
|
110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
71 |
/** Identification of and link to the waiting fibril. */
|
72 |
fid_t fid; |
|
73 |
||
74 |
/** If true, this fibril is currently active. */
|
|
75 |
bool active; |
|
538.1.300
by Martin Decky
make the libc private header really private (i.e. do not allow to be included from outside the library easily) |
76 |
|
110.1.3
by Jakub Jermar
Separate timeout-specific wait data from generic wait data in awaiter_t. |
77 |
/** Timeout wait data. */
|
78 |
to_event_t to_event; |
|
110.1.5
by Jakub Jermar
Experimental support for timeoutable fibril condition variables. |
79 |
/** Wakeup wait data. */
|
80 |
wu_event_t wu_event; |
|
110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
81 |
} awaiter_t; |
82 |
||
538.1.925
by Jakub Jermar
Small improvements in the async framework. |
83 |
extern void awaiter_initialize(awaiter_t *); |
84 |
||
538.32.5
by Martin Decky
improve run-time termination |
85 |
extern void __async_init(void); |
538.1.300
by Martin Decky
make the libc private header really private (i.e. do not allow to be included from outside the library easily) |
86 |
extern void async_insert_timeout(awaiter_t *); |
538.1.471
by Martin Decky
new async framework with integrated exchange tracking |
87 |
extern void reply_received(void *, int, ipc_call_t *); |
110.1.4
by Jakub Jermar
Rename insert_timeout() to async_insert_timeout() and make it a private global |
88 |
|
110.1.2
by Jakub Jermar
Prepare awaiter_t for use outside of async.c. |
89 |
#endif
|
90 |
||
91 |
/** @}
|
|
92 |
*/
|