コード例 #1
0
ファイル: _nib-6ln.c プロジェクト: drmrboy/RIOT
void _handle_rereg_address(const ipv6_addr_t *addr)
{
    gnrc_netif_t *netif = gnrc_netif_get_by_ipv6_addr(addr);
    _nib_dr_entry_t *router = _nib_drl_get_dr();
    const bool router_reachable = (router != NULL) &&
                                  _is_reachable(router->next_hop);

    if (router_reachable && (netif != NULL)) {
        assert((unsigned)netif->pid == _nib_onl_get_if(router->next_hop));
        DEBUG("nib: Re-registering %s",
              ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)));
        DEBUG(" with upstream router %s\n",
              ipv6_addr_to_str(addr_str, &router->next_hop->ipv6,
                               sizeof(addr_str)));
        _snd_ns(&router->next_hop->ipv6, netif, addr, &router->next_hop->ipv6);
    }
    else {
        DEBUG("nib: Couldn't re-register %s, no current router found or address "
              "wasn't assigned to any interface anymore.\n",
              ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)));
    }
    if (netif != NULL) {
        int idx = gnrc_netif_ipv6_addr_idx(netif, addr);

        if (router_reachable &&
            (_is_valid(netif, idx) || (_is_tentative(netif, idx) &&
             (gnrc_netif_ipv6_addr_dad_trans(netif, idx) <
              SIXLOWPAN_ND_REG_TRANSMIT_NUMOF)))) {
            uint32_t retrans_time;

            if (_is_valid(netif, idx)) {
                retrans_time = SIXLOWPAN_ND_MAX_RS_SEC_INTERVAL * MS_PER_SEC;
            }
            else {
                retrans_time = netif->ipv6.retrans_time;
                /* increment encoded retransmission count */
                netif->ipv6.addrs_flags[idx]++;
            }
            _evtimer_add(&netif->ipv6.addrs[idx], GNRC_IPV6_NIB_REREG_ADDRESS,
                         &netif->ipv6.addrs_timers[idx], retrans_time);
        }
        else {
            netif->ipv6.rs_sent = 0;
            _handle_search_rtr(netif);
        }
    }
}
コード例 #2
0
void
handle_expunge(int handle)
{
    pthread_mutex_lock(&lock);
    if (_is_valid(handle, HANDLETYPE_ANY)) {
        VdpGenericData *gh = g_hash_table_lookup(vdp_handles, GINT_TO_POINTER(handle));
        if (gh)
            pthread_mutex_unlock(&gh->lock);
        g_hash_table_remove(vdp_handles, GINT_TO_POINTER(handle));
    }
    pthread_mutex_unlock(&lock);
}
コード例 #3
0
void
handle_expunge(int handle)
{
    pthread_mutex_lock(&lock);
    if (_is_valid(handle, HANDLETYPE_ANY)) {
        VdpGenericHandle *gh = g_ptr_array_index(vdpHandles, handle);
        if (gh)
            pthread_mutex_unlock(&gh->lock);
        g_ptr_array_index(vdpHandles, handle) = NULL;
    }
    pthread_mutex_unlock(&lock);
}
コード例 #4
0
ファイル: texture.cpp プロジェクト: AutonomicStudios/godot
void CubeMap::set_side(Side p_side,const Image& p_image) {

	ERR_FAIL_COND(p_image.empty());
	ERR_FAIL_INDEX(p_side,6);
	if (!_is_valid()) {
		format = p_image.get_format();
		w=p_image.get_width();
		h=p_image.get_height();
		VS::get_singleton()->texture_allocate(cubemap,w,h,p_image.get_format(),flags|VS::TEXTURE_FLAG_CUBEMAP);
	}

	VS::get_singleton()->texture_set_data(cubemap,p_image,VS::CubeMapSide(p_side));
	valid[p_side]=true;
}
コード例 #5
0
void *
handle_acquire(int handle, HandleType type)
{
    VdpGenericHandle *res = NULL;

    while (1) {
        pthread_mutex_lock(&lock);
        if (!_is_valid(handle, type))
            break;
        res = g_ptr_array_index(vdpHandles, handle);
        if (pthread_mutex_trylock(&res->lock) == 0)
            break;
        pthread_mutex_unlock(&lock);
        usleep(1);
    }

    pthread_mutex_unlock(&lock);
    return res;
}
コード例 #6
0
void *
handle_acquire(int handle, HandleType type)
{
    VdpGenericData *res = NULL;

    while (1) {
        pthread_mutex_lock(&lock);
        if (!_is_valid(handle, type)) {
            res = NULL;
            break;
        }
        res = g_hash_table_lookup(vdp_handles, GINT_TO_POINTER(handle));
        if (pthread_mutex_trylock(&res->lock) == 0)
            break;
        pthread_mutex_unlock(&lock);
        usleep(1);
    }

    pthread_mutex_unlock(&lock);
    return res;
}
コード例 #7
0
ファイル: texture.cpp プロジェクト: AutonomicStudios/godot
void CubeMap::set_flags(uint32_t p_flags) {

	flags=p_flags;
	if (_is_valid())
		VS::get_singleton()->texture_set_flags(cubemap,flags|VS::TEXTURE_FLAG_CUBEMAP);
}