PPP, PPPoS, PPP_INPROC_MULTITHREADED defaults to 0, explain thread safety issue with it

This commit is contained in:
Sylvain Rochet 2015-03-11 01:20:53 +01:00
parent 9778b1411c
commit 4b035b9902
2 changed files with 21 additions and 5 deletions

View File

@ -1917,11 +1917,21 @@
/**
* PPP_INPROC_MULTITHREADED==1 call ppp_input() using tcpip_callback().
* Set this to 0 if pppos_input() is called inside tcpip_thread or with NO_SYS==1.
* Default is 1 for NO_SYS==0 (multithreaded) and 0 for NO_SYS==1 (single-threaded).
*
* Set this to 0 in the following cases:
* - pppos_input() is called from the main loop and NO_SYS==1
* - you are using tcpip_input() (NO_SYS==0) on PPP data input
*
* Otherwise, if pppos_input() is called outside lwIP context (IRQ)
* set this to 1.
*
* CAUTION: if set to 1, you should NEVER call pppos_connect(), pppos_listen()
* and ppp_free() if pppos_input() can still be running, doing this is not
* thread safe. You should also avoid calling pppos_input() if PPPoS session
* is not started yet.
*/
#ifndef PPP_INPROC_MULTITHREADED
#define PPP_INPROC_MULTITHREADED (NO_SYS==0)
#define PPP_INPROC_MULTITHREADED 0
#endif
/**

View File

@ -556,8 +556,14 @@ PACK_STRUCT_END
#endif
#endif /* PPP_INPROC_MULTITHREADED */
/** Pass received raw characters to PPPoS to be decoded. This function is
* thread-safe and can be called from a dedicated RX-thread or from a main-loop.
/** Pass received raw characters to PPPoS to be decoded.
*
* This function is thread-safe if PPP_INPROC_MULTITHREADED is set to 1
* and can be called from a dedicated RX-thread or from interrupt context
* BUT you should NEVER call pppos_connect(), pppos_listen()
* and ppp_free() if pppos_input() can still be running, doing this is not
* thread safe. You should also avoid calling pppos_input() if PPPoS session
* is not started yet.
*
* @param pcb PPP descriptor index, returned by ppp_new()
* @param data received data