This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3120MOD: sl_stop stucks because of sl_select

Part Number: CC3120MOD

Hi,

I'm using CC3120MOD with following host driver/service pack/etc:

CHIP 822083584
MAC 31.2.0.0.0
PHY 2.2.0.6
NWP 3.11.1.0
ROM 0
HOST 3.0.1.61

For my application, I'm opening two different TCP socket. I have a dedicated task which, by mean of sl_select function call, is responsible for waiting data from sockets and calling installed callback to signal data to user.

Here the pseudo code of my task:

/* Task loop. */
while (true)
{
    int16_t res;
    uint8_t i;

    /* Wait for any socket. */
    rxSet.fd_array[0] = 0xFFFFFFFF;

    /* Check for activity (blocking). */
    if ((res = sl_Select (0, &rxSet, NULL, NULL, NULL)) > 0)
    {
        /* Loop over sockets. */
        for (i = 0; i < WIFI_SOCKET_MAX; i++)
        {
            /* Get socket handle. */
            handle = Wifi_SocketHandle[i];

            /* Configure descriptor. */
            SL_SOCKET_FD_ZERO (&rxSet);
            SL_SOCKET_FD_SET  (handle, &rxSet);

            /* Clear timeout. */
            timeVal.tv_sec  = 0;
            timeVal.tv_usec = 0;

            /* Call selet again (with no timeout). */
            res = sl_Select (0, &rxSet, NULL, NULL, &timeVal);

            /* Something received? */
            if (res > 0)
            {
                /* Read received data from socket. */
                if ((res = sl_Recv (handle, buffer, sizeof (buffer), 0)) > 0)
                {
                    // call user callback with data
                }
                else
                {
                    // Socket closed? call user callback with error
                }
            }
            else
            {
                /* Just do nothing. */
            }
        }
    }
    else
    {
        //@todo
    }
}

Everything is working like a charm, except for one thing: when I call sl_stop, the function hangs on this loop:

#ifdef SL_PLATFORM_MULTI_THREADED
    /* Do not continue until all sync object deleted (in relevant context) */
    while (g_pCB->NumOfDeletedSyncObj < MAX_CONCURRENT_ACTIONS)
    {
        usleep(100000);
    }
#endif

I think that's because sl_select is blocking waiting for data to be received. I tried also to close all sockets prior to call sl_stop, but sl_select never returns.

This is a known issue? Any workaround to this? I used to use old service pack and host driver and I don't remember such a problem.

Thanks in adavance.

Alessandro