2 Replies Latest reply on Apr 17, 2016 9:26 PM by hardy.chen

    Force networking thread to wakeup at link_up and link_down in wifi.c

    hardy.chen

      Hi,

       

      Just a question about the consistence of managing networking thread while doing notification of link status.

      Is anyone know the reason that why it doesn't need to *force wake up* networking thread at link_up case?

       

      I happened to see the missing of link_up callback been called successfully to my application, is this related to this design?

       

      static void link_up( void )
      {
          if ( wiced_sta_link_up == WICED_FALSE )
          {
              wiced_network_notify_link_up( WICED_STA_INTERFACE );
              wiced_rtos_send_asynchronous_event( WICED_NETWORKING_WORKER_THREAD, wiced_wireless_link_up_handler, 0 );
              wiced_sta_link_up = WICED_TRUE;
          }
          else
          {
              wiced_rtos_send_asynchronous_event( WICED_NETWORKING_WORKER_THREAD, wiced_wireless_link_renew_handler, 0 );
          }
      }
      
      
      static void link_down( void )
      {
          if ( wiced_sta_link_up == WICED_TRUE )
          {
              /* Notify network stack that the link is down. Further processing will be done in the link down handler */
              wiced_network_notify_link_down( WICED_STA_INTERFACE );
      
      
              /* Force awake the networking thread. It might still be blocked on receive or send timeouts */
              wiced_rtos_thread_force_awake( &(WICED_NETWORKING_WORKER_THREAD->thread) );
      
      
              wiced_rtos_send_asynchronous_event( WICED_NETWORKING_WORKER_THREAD, wiced_wireless_link_down_handler, 0 );
              wiced_sta_link_up = WICED_FALSE;
          }
      }