lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwIP and threads


From: Simon Goldschmidt
Subject: Re: [lwip-users] lwIP and threads
Date: Wed, 23 Jan 2013 17:54:58 +0100

LwIP doesn't really support threads. Instead, in threaded mode, lwIP runs in one dedicated thread (often called the tcpip_thread, based on the thread loop function). All packet processing is done in this thread. Raw API callbacks are done in this thread, too. The only things that are allowed outside of this thread are:
A) allocating pbufs (from the driver)
B) calling thread-safe functions of the API layer (e.g. Netconn API, sockets, etc.)

When not using the netconn or socket API, you can implement the main loop running in its dedicated thread yourself, but it might be easier to use the existing code and implement a sys adaption layer. Also, be aware that you must not call timer functions or input packet processing from an ISR or another thread!

Simon


Am 23.01.2013 um 16:18 schrieb "Thomas Riedrich" <address@hidden>:

Hello,
I need some clarification on lwIP and threads. The wiki says that lwIP CAN use threads, but doesn’t need threads. What I want to do is the following:
 
Receive pictures using lwIP, store them in a RAM file system, process them, and send them back using lwIP. So I need lwIP to run in ONE thread ALONGSIDE another thread which does the image processing, but I don’t need for lwIP to split up into several threads.
 
So my question is how I would implement sys_arch.c. Would I still have to port it to the multithreading system I’m using? Does lwIP have to “know” that I’m using threads in this case? Or could I just rewrite tcpip_init to use my own start_new_thread function instead of lwIPs own sys_thread_new?
 
Thanks
Tom
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

[Prev in Thread] Current Thread [Next in Thread]