本文整理汇总了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);
}
示例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);
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}