The Pedigree Project  0.1
lwip.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "modules/Module.h"
21 
22 #include "pedigree/kernel/process/Mutex.h"
23 
26 
27 // Switch the module-specific pieces of the module over to hidden visibility
28 #pragma GCC visibility push(hidden)
29 
30 static Mutex tcpipInitPending(false);
31 
32 static void tcpipInitComplete(void *)
33 {
34  tcpipInitPending.release();
35 }
36 
37 static bool entry()
38 {
39  tcpipInitPending.acquire();
40 
41  // make sure the multi threaded lwIP implementation is ready to go
43  tcpip_init(tcpipInitComplete, nullptr);
44 
45  tcpipInitPending.acquire();
46 
47  return true;
48 }
49 
50 static void exit()
51 {
53 }
54 
55 MODULE_INFO("lwip", &entry, &exit);
bool acquire(size_t n=1, size_t timeoutSecs=0, size_t timeoutUsecs=0)
Definition: Semaphore.h:62
Definition: Mutex.h:58
void release(size_t n=1)
Definition: Semaphore.cc:239
void tcpip_init(tcpip_init_done_fn initfunc, void *arg)
Definition: tcpip.c:481