source: mainline/libc/generic/async.c@ 450cd3a

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 450cd3a was 450cd3a, checked in by Ondrej Palkovsky <ondrap@…>, 19 years ago

Merge ipc and libc. Does not compile.

  • Property mode set to 100644
File size: 2.2 KB
Line 
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
29ipc_wait_t call_func(args)
30{
31}
32
33ipc_wait_t fire_function(args)
34{
35 stack = malloc(stacksize);
36 setup(stack);
37 add_to_list_of_ready_funcs(stack);
38 if (threads_waiting_for_message)
39 send_message_to_self_to_one_up();
40}
41
42void discard_result(ipc_wait_t funcid)
43{
44}
45
46int wait_result(ipc_wait_t funcid);
47{
48 save_context(self);
49restart:
50 if result_available() {
51 if in_list_of_ready(self):
52 tear_off_list(self);
53 return retval;
54 }
55 add_to_waitlist_of(funcid);
56
57 take_something_from_list_of_ready();
58 if something {
59
60 restore_context(something);
61 } else { /* nothing */
62 wait_for_call();
63 if (answer) {
64 mark_result_ready();
65 put_waiting_thread_to_waitlist();
66
67 goto restart;
68 }
69 }
70
71}
72
73
74int ipc_call_sync(args)
75{
76 return ipc_wait(call_func(args));
77}
Note: See TracBrowser for help on using the repository browser.