当前位置: 首页>>代码示例>>C++>>正文


C++ MAGIC_ASSERT函数代码示例

本文整理汇总了C++中MAGIC_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ MAGIC_ASSERT函数的具体用法?C++ MAGIC_ASSERT怎么用?C++ MAGIC_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MAGIC_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: software_free

void software_free(gpointer data) {
	Software* software = data;
	MAGIC_ASSERT(software);

	g_string_free(software->arguments, TRUE);
	g_string_free(software->pluginPath, TRUE);

	MAGIC_CLEAR(software);
	g_free(software);
}
开发者ID:anupam-das,项目名称:shadow,代码行数:10,代码来源:shd-software.c

示例2: scheduler_unref

void scheduler_unref(Scheduler* scheduler) {
    MAGIC_ASSERT(scheduler);
    g_mutex_lock(&(scheduler->globalLock));
    scheduler->referenceCount--;
    gboolean shouldFree = (scheduler->referenceCount <= 0) ? TRUE : FALSE;
    g_mutex_unlock(&(scheduler->globalLock));
    if(shouldFree) {
        _scheduler_free(scheduler);
    }
}
开发者ID:desphunter,项目名称:shadow,代码行数:10,代码来源:shd-scheduler.c

示例3: socket_getOutputBufferSpace

gsize socket_getOutputBufferSpace(Socket* socket) {
    MAGIC_ASSERT(socket);
    utility_assert(socket->outputBufferSize >= socket->outputBufferLength);
    gsize bufferSize = socket_getOutputBufferSize(socket);
    if(bufferSize < socket->outputBufferLength) {
        return 0;
    } else {
        return bufferSize - socket->outputBufferLength;
    }
}
开发者ID:4sp1r3,项目名称:shadow,代码行数:10,代码来源:shd-socket.c

示例4: _address_free

static void _address_free(Address* address) {
    MAGIC_ASSERT(address);

    g_free(address->ipString);
    g_free(address->name);
    g_free(address->idString);

    MAGIC_CLEAR(address);
    g_free(address);
}
开发者ID:4sp1r3,项目名称:shadow,代码行数:10,代码来源:shd-address.c

示例5: engine_get

gpointer engine_get(Engine* engine, EngineStorage type, GQuark id) {
	MAGIC_ASSERT(engine);

	/*
	 * Return the item corresponding to type and id in a thread-safe way.
	 * I believe for now no protections are necessary since our registry
	 * is read-only.
	 */
	return registry_get(engine->registry, type, &id);
}
开发者ID:ln5,项目名称:shadow,代码行数:10,代码来源:shd-engine.c

示例6: tracker_addVirtualProcessingDelay

void tracker_addVirtualProcessingDelay(Tracker* tracker, SimulationTime delay) {
    MAGIC_ASSERT(tracker);

    if(_tracker_getFlags(tracker) & TRACKER_FLAGS_NODE) {
        (tracker->numDelayedTotal)++;
        tracker->delayTimeTotal += delay;
        (tracker->numDelayedLastInterval)++;
        tracker->delayTimeLastInterval += delay;
    }
}
开发者ID:4sp1r3,项目名称:shadow,代码行数:10,代码来源:shd-tracker.c

示例7: connectnetwork_run

void connectnetwork_run(ConnectNetworkAction* action) {
    MAGIC_ASSERT(action);

    internetwork_connectNetworks(worker_getInternet(),
                                 action->sourceClusterID, action->destinationClusterID,
                                 action->latency, action->jitter, action->packetloss,
                                 action->latencymin, action->latencyQ1, action->latencymean,
                                 action->latencyQ3, action->latencymax);

}
开发者ID:ln5,项目名称:shadow,代码行数:10,代码来源:shd-connect-network.c

示例8: cpu_getDelay

SimulationTime cpu_getDelay(CPU* cpu) {
	MAGIC_ASSERT(cpu);

	/* we only have delay if we've crossed the threshold */
	SimulationTime builtUpDelay = cpu->timeCPUAvailable - cpu->now;
	if(builtUpDelay > cpu->threshold) {
		return builtUpDelay;
	}
	return 0;
}
开发者ID:anupam-das,项目名称:shadow,代码行数:10,代码来源:shd-cpu.c

示例9: engine_put

void engine_put(Engine* engine, EngineStorage type, GQuark* id, gpointer item) {
	MAGIC_ASSERT(engine);

	/*
	 * put the item corresponding to type and id in a thread-safe way.
	 * I believe for now no protections are necessary since our registry
	 * is filled before simulation and is read only.
	 */
	registry_put(engine->registry, type, id, item);
}
开发者ID:ln5,项目名称:shadow,代码行数:10,代码来源:shd-engine.c

示例10: _host_monitorDescriptor

static gint _host_monitorDescriptor(Host* host, Descriptor* descriptor) {
	MAGIC_ASSERT(host);

	/* make sure there are no collisions before inserting */
	gint* handle = descriptor_getHandleReference(descriptor);
	utility_assert(handle && !host_lookupDescriptor(host, *handle));
	g_hash_table_replace(host->descriptors, handle, descriptor);

	return *handle;
}
开发者ID:HackerJLY,项目名称:shadow,代码行数:10,代码来源:shd-host.c

示例11: _tcp_getBufferSpaceOut

static gsize _tcp_getBufferSpaceOut(TCP* tcp) {
	MAGIC_ASSERT(tcp);
	/* account for throttled and retransmission buffer */
	gssize s = (gssize)(socket_getOutputBufferSpace(&(tcp->super)) - tcp->throttledOutputLength - tcp->retransmissionLength);
	gsize space = MAX(0, s);
	if(space == 0) {
		descriptor_adjustStatus((Descriptor*)tcp, DS_WRITABLE, FALSE);
	}
	return space;
}
开发者ID:icbaker,项目名称:shadow,代码行数:10,代码来源:shd-tcp.c

示例12: epoll_tryNotify

void epoll_tryNotify(Epoll* epoll) {
	MAGIC_ASSERT(epoll);

	if(_epoll_isReadyToNotify(epoll)) {
		application_notify(epoll->ownerApplication);

		/* check if we need to be notified again */
		_epoll_ensureTriggers(epoll);
	}
}
开发者ID:icbaker,项目名称:shadow,代码行数:10,代码来源:shd-epoll.c

示例13: _tcp_endOfFileSignalled

static void _tcp_endOfFileSignalled(TCP* tcp) {
	MAGIC_ASSERT(tcp);

	debug("%s <-> %s: signaling close to user, socket no longer usable", tcp->super.boundString, tcp->super.peerString);
	tcp->flags |= TCPF_EOF_SIGNALED;

	/* user can no longer access socket */
	descriptor_adjustStatus(&(tcp->super.super.super), DS_CLOSED, TRUE);
	descriptor_adjustStatus(&(tcp->super.super.super), DS_ACTIVE, FALSE);
}
开发者ID:icbaker,项目名称:shadow,代码行数:10,代码来源:shd-tcp.c

示例14: tracker_free

void tracker_free(Tracker* tracker) {
    MAGIC_ASSERT(tracker);

    g_hash_table_foreach(tracker->allocatedLocations, _tracker_freeAllocatedLocations, NULL);
    g_hash_table_destroy(tracker->allocatedLocations);
    g_hash_table_destroy(tracker->socketStats);

    MAGIC_CLEAR(tracker);
    g_free(tracker);
}
开发者ID:4sp1r3,项目名称:shadow,代码行数:10,代码来源:shd-tracker.c

示例15: worker_free

void worker_free(gpointer data) {
	Worker* worker = data;
	MAGIC_ASSERT(worker);

	/* calls the destroy functions we specified in g_hash_table_new_full */
	g_hash_table_destroy(worker->plugins);

	MAGIC_CLEAR(worker);
	g_free(worker);
}
开发者ID:icbaker,项目名称:shadow,代码行数:10,代码来源:shd-worker.c


注:本文中的MAGIC_ASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。