int ff_del_syncobj (    /* TRUE:Function succeeded, FALSE:Could not delete due to any error */
    _SYNC_t sobj        /* Sync object tied to the logical drive to be deleted */
)
{
  osSemaphoreDelete (sobj);
  return 1;
}
void osDeleteSemaphore(OsSemaphore *semaphore)
{
   //Make sure the semaphore ID is valid
   if(semaphore->id != NULL)
   {
      //Properly dispose the specified semaphore
      osSemaphoreDelete(semaphore->id);
   }
}
void osDeleteEvent(OsEvent *event)
{
   //Make sure the semaphore ID is valid
   if(event->id != NULL)
   {
      //Properly dispose the event object
      osSemaphoreDelete(event->id);
   }
}
/*!  
    \brief Deleting Semaphore
    \return 0=successful; -1=failure
*/
int Delete_Semaphore1 (void) 
{
  if ( osSemaphoreDelete(sid_Semaphore1) != osOK)
	{
 //TWP   if (addTrace("sem1 - could not delete") != TRACE_OK)
//TWP		{
//TWP			stop_cpu;
//TWP		}
		return (-1);
  } 
  return(0);
}
示例#5
0
Semaphore::~Semaphore()
{
    osSemaphoreDelete(_id);
}
示例#6
0
nsapi_error_t LWIP::Interface::bringdown()
{
    // Check if we've connected
    if (connected == NSAPI_STATUS_DISCONNECTED) {
        return NSAPI_ERROR_NO_CONNECTION;
    }

#if LWIP_DHCP
    // Disconnect from the network
    if (dhcp_started) {
        dhcp_release(&netif);
        dhcp_stop(&netif);
        dhcp_started = false;
        dhcp_has_to_be_set = false;
    }
#endif

    if (ppp) {
        /* this is a blocking call, returns when PPP is properly closed */
        err_t err = ppp_lwip_disconnect(hw);
        if (err) {
            return err_remap(err);
        }
        MBED_ASSERT(!netif_is_link_up(&netif));
        /*if (netif_is_link_up(&netif)) {
            if (sys_arch_sem_wait(&unlinked, 15000) == SYS_ARCH_TIMEOUT) {
                return NSAPI_ERROR_DEVICE_ERROR;
            }
        }*/
    } else {
        netif_set_down(&netif);
    }

#if LWIP_IPV6
    mbed_lwip_clear_ipv6_addresses(&netif);
#endif
#if LWIP_IPV4
    ip_addr_set_zero(&(netif.ip_addr));
    ip_addr_set_zero(&(netif.netmask));
    ip_addr_set_zero(&(netif.gw));
#endif

    osSemaphoreDelete(has_any_addr);
    osSemaphoreAttr_t attr;
    attr.name = NULL;
    attr.attr_bits = 0;
    attr.cb_mem = &has_any_addr_sem;
    attr.cb_size = sizeof has_any_addr_sem;
    has_any_addr = osSemaphoreNew(UINT16_MAX, 0, &attr);
#if PREF_ADDR_TIMEOUT
    osSemaphoreDelete(has_pref_addr);
    attr.cb_mem = &has_pref_addr_sem;
    attr.cb_size = sizeof has_pref_addr_sem;
    has_pref_addr = osSemaphoreNew(UINT16_MAX, 0, &attr);
#endif
#if BOTH_ADDR_TIMEOUT
    osSemaphoreDelete(has_both_addr);
    attr.cb_mem = &has_both_addr_sem;
    attr.cb_size = sizeof has_both_addr_sem;
    has_both_addr = osSemaphoreNew(UINT16_MAX, 0, &attr);
#endif
    has_addr_state = 0;

    connected = NSAPI_STATUS_DISCONNECTED;
    if (client_callback) {
        client_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, connected);
    }
    return 0;
}
示例#7
0
Semaphore::~Semaphore() {
    osSemaphoreDelete(_osSemaphoreId);
}