[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] ¿¿¿¿lwIP BUGin sys_mbox_post????
From: |
Sergio PérezAlcañiz |
Subject: |
[lwip-users] ¿¿¿¿lwIP BUGin sys_mbox_post???? |
Date: |
Thu, 27 Mar 2003 09:20:55 +0100 (CET) |
User-agent: |
IMP/PHP IMAP webmail program 2.2.3 |
I'm reporting a need that I had when porting lwIP to RT-Linux. RT-Linux offers
semaphores, so mapping rtl_sem to sys_sem was a simple task. But when posting a
semaphore something "special" happened. The RT-Linux function that posts
semaphores has a call to the scheduler at the end of its implementation, so when
called, the task performing the call is ¿ejected? from the CPU. When
multithreading is possible as in RT-Linux, there is eventually a deadlock
between tasks calling sys_mbox_post. The way I solved that was implementing a
non ejecting post for semaphores that I called sys_sem_signal_pre. At least,
that call is needed in sys_mbox_post implementation. ¿¿Is this a bug?? I don't
think so, but in those contexts similar to the RT-Linux one may cause errors.
Regards.
Sergio.
void
sys_mbox_post(struct sys_mbox *mbox, void *msg)
{
u8_t first;
unsigned int state;
sys_sem_wait(mbox->mutex);
mbox->msgs[mbox->last] = msg;
if(mbox->last == mbox->first) {
first = 1;
} else {
first = 0;
}
mbox->last++;
if(mbox->last == SYS_MBOX_SIZE) {
mbox->last = 0;
}
sys_stop_interrupts(&state);
if(first){
sys_sem_signal_pre(mbox->mail);
}
sys_sem_signal(mbox->mutex);
sys_allow_interrupts(&state);
}
- [lwip-users] ¿¿¿¿lwIP BUGin sys_mbox_post????,
Sergio PérezAlcañiz <=