本文整理汇总了C++中OE::yieldthread方法的典型用法代码示例。如果您正苦于以下问题:C++ OE::yieldthread方法的具体用法?C++ OE::yieldthread怎么用?C++ OE::yieldthread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OE
的用法示例。
在下文中一共展示了OE::yieldthread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cmaphore_destroy
void Cmaphore_destroy(Cmaphore * c) {
OE oe = 0;
Cmaphore s = 0;
if (!c) return;
if (!*c) return;
s = *c;
oe = s->oe;
// inform all down's that we are destroying this semaphore
oe->lock(s->lock);
s->oe = 0;
oe->unlock(s->lock);
// give all other threads a chance to run.
oe->yieldthread();
// Really now we destroy it !
oe->lock(s->lock);
s->count = 0;
oe->destroymutex(&s->lock);
zeromem(s, sizeof(*s));
*c = 0;
oe->putmem(s);
}
示例2: Cmaphore_down
void Cmaphore_down(Cmaphore c) {
OE oe = 0;
if (!c) return;
if (!c->lock) return;
oe = c->oe;
if (!oe) return;
oe->lock(c->lock);
while(c->count <= 0) {
oe->unlock( c->lock );
oe->yieldthread();
oe->lock( c->lock );
if (!c->oe) {
oe->unlock(c->lock);
return; // semaphore destroyed, leave !
}
}
--(c->count);
oe->unlock( c->lock );
}