tcpip_send_msg_wait_sem() declaration

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

tcpip_send_msg_wait_sem() declaration

Joan Lledó
Hello lwip,

I have a question: Why is tcpip_send_msg_wait_sem() declared in
tcpip_priv.h, why not in tcpip.h?

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

goldsimon@gmx.de


On 12.05.19 12:51, Joan Lledó wrote:
> Hello lwip,
>
> I have a question: Why is tcpip_send_msg_wait_sem() declared in
> tcpip_priv.h, why not in tcpip.h?

Probably just because there was no public use so far. And keeping it in
tcpip_priv.h has the meaning of "don't rely on this to be available in
the next version".

Would you need to move this to tcpip.h?

Regards,
Simon

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

Joan Lledó
> Would you need to move this to tcpip.h?

Not necessarily, I was looking for a way to call a function inside the
tcpip thread and wait for it to finish. tcpip_send_msg_wait_sem()
seems to be what I need, but maybe there's another way. We could add
another tcpip_callbackmsg* function to wait for the sem in *msg. Why
is tcpip_callbackmsg_trycallback() calling sys_mbox_trypost() instead
of sys_mbox_post()?

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

Dirk Ziegelmeier-2
It only TRIES to post a message. When the MBOX is full, you get an error code as return value instead of blocking the call.


Dirk


On Mon, May 13, 2019 at 8:45 AM Joan Lledó <[hidden email]> wrote:
> Would you need to move this to tcpip.h?

Not necessarily, I was looking for a way to call a function inside the
tcpip thread and wait for it to finish. tcpip_send_msg_wait_sem()
seems to be what I need, but maybe there's another way. We could add
another tcpip_callbackmsg* function to wait for the sem in *msg. Why
is tcpip_callbackmsg_trycallback() calling sys_mbox_trypost() instead
of sys_mbox_post()?

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

goldsimon@gmx.de
In reply to this post by Joan Lledó
Am 13.05.2019 um 08:44 schrieb Joan Lledó:
>> Would you need to move this to tcpip.h?
>
> Not necessarily, I was looking for a way to call a function inside the
> tcpip thread and wait for it to finish. tcpip_send_msg_wait_sem()
> seems to be what I need, but maybe there's another way. We could add
> another tcpip_callbackmsg* function to wait for the sem in *msg. Why
> is tcpip_callbackmsg_trycallback() calling sys_mbox_trypost() instead
> of sys_mbox_post()?

Ok, so I don't think there's a problem with making such a function part
of the "public" API, but the current name is not good enough for that.

Make it something like "tcpip_try_callback_sem" and I'll accept your
patch ;-)

Regards,
Simon

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

Joan Lledó
> Ok, so I don't think there's a problem with making such a function part
> of the "public" API, but the current name is not good enough for that.
>
> Make it something like "tcpip_try_callback_sem" and I'll accept your
> patch ;-)

I'm sorry but it's not clear to me. To clarify: do you mean renaming
tcpip_send_msg_wait_sem(), right?

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

goldsimon@gmx.de
Am 16.05.2019 um 19:57 schrieb Joan Lledó:
>> Ok, so I don't think there's a problem with making such a function part
>> of the "public" API, but the current name is not good enough for that.
>>
>> Make it something like "tcpip_try_callback_sem" and I'll accept your
>> patch ;-)
>
> I'm sorry but it's not clear to me. To clarify: do you mean renaming
> tcpip_send_msg_wait_sem(), right?

I rather thought you'd need a new function with that name. Looking at
what tcpip_send_msg_wait_sem() does, I don't think it's what you need?
The 'sem' is not a semaphore that should be signaled when it's done, but
a semaphore that tcpip_send_msg_wait_sem() uses to block before return...

Regards,
Simon

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

Joan Lledó
> I rather thought you'd need a new function with that name. Looking at
> what tcpip_send_msg_wait_sem() does, I don't think it's what you need?
> The 'sem' is not a semaphore that should be signaled when it's done, but
> a semaphore that tcpip_send_msg_wait_sem() uses to block before return...

Oh no, I only need to call a function inside the tcpip thread and wait
for it to return, tcpip_send_msg_wait_sem() does it so it's enough for
me. Moreover, when LWIP_TCPIP_CORE_LOCKING is enabled, you don't even
need a semaphore, so it's a lot easier to use.

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: tcpip_send_msg_wait_sem() declaration

Joan Lledó
OK, now I understood what you mean. Yes, tcpip_send_msg_wait_sem() is
good for me because I use LWIP_TCPIP_CORE_LOCKING, otherwise I would
need another function... mmm I'm not sure I'm ready to write such a
function right now, maybe I'll try it and send a patch.

Missatge de Joan Lledó <[hidden email]> del dia dv., 17 de
maig 2019 a les 20:03:

>
> > I rather thought you'd need a new function with that name. Looking at
> > what tcpip_send_msg_wait_sem() does, I don't think it's what you need?
> > The 'sem' is not a semaphore that should be signaled when it's done, but
> > a semaphore that tcpip_send_msg_wait_sem() uses to block before return...
>
> Oh no, I only need to call a function inside the tcpip thread and wait
> for it to return, tcpip_send_msg_wait_sem() does it so it's enough for
> me. Moreover, when LWIP_TCPIP_CORE_LOCKING is enabled, you don't even
> need a semaphore, so it's a lot easier to use.

_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel