This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How do I manually clear wakeup_event.chan?


I found a solution to my v1.3.1 cyg_tsleep problem
where wakeups were not timing out resulting
in connect failing.  By pasting a line to clear the 
wakeup strcutre array's semaphore.  I found this in 
the CVS build cyg_tsleep function in file synch.c.  

my v1.3.1 fix:

File: tcpip/v1_0b1/src/ecos/support.c

Starting at line:

    cyg_scheduler_unlock();

Add this line of code:

    cyg_semaphore_init(&ev->sem,0);

Continuing with exisiting code:

    if (timo) {
        sleep_time = cyg_current_time() + timo;
        if (!cyg_semaphore_timed_wait(&ev->sem, sleep_time)) {
            res = ETIMEDOUT;
            ev->chan = 0;  // Free slot
        }
    } else {
        cyg_semaphore_wait(&ev->sem);
    }
    return res;


In a message dated Sun, 29 Oct 2000  1:01:09 AM Eastern Standard Time, 
AshCan@aol.com writes:

<< Just a few more important details.

> In a message dated 10/27/00 5:28:19 PM Pacific 
> Daylight Time, AshCan@aol.com 
> writes:

> > In testing my software, I am trying to gracefully 
> >  shutdown and close the socket and then delete the 
> >  thread.  
> >  

> The thread simply upon command, opens sockets, connects to a server, and
> reads streamed audio data.  When I delete the thread, the thread could be 
> anywhere
> in its processing, not necessarily in the middle of a recv.

> >  This works until the number of thread deletions exceeds 
> >  my CYG_NET_NUM_WAKEUP_EVENTS = 8 and I get ETIMEDOUT upon 
> > connect.  I look into the wakeup_list[] structure 
> >  array and sure enough, it is fully occupied.  

> This problem does not occur when I do not delete my  network thread and only
> shutdown and close sockets.

> >  
> >  Is there an easy function call I can make to clear the 
> >  socket's wakeup_event structre entry before I terminate 
> >  the thread?
> >  
> >  I am using v1.3.1, ARM EDB7212 target.
> >  



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]