本文整理汇总了C++中ACE_Unbounded_Queue::dequeue_head方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Unbounded_Queue::dequeue_head方法的具体用法?C++ ACE_Unbounded_Queue::dequeue_head怎么用?C++ ACE_Unbounded_Queue::dequeue_head使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Unbounded_Queue
的用法示例。
在下文中一共展示了ACE_Unbounded_Queue::dequeue_head方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveFile
bool saveFile(const char *name) {
mutex.wait();
saving = false;
Sound total;
total.resize(samples,channels);
long int at = 0;
while (!sounds.is_empty()) {
Sound tmp;
sounds.dequeue_head(tmp);
for (int i=0; i<channels; i++) {
for (int j=0; j<tmp.getSamples(); j++) {
total.set(tmp.get(j,i),at+j,i);
}
}
total.setFrequency(tmp.getFrequency());
at += tmp.getSamples();
}
mutex.post();
bool ok = write(total,name);
if (ok) {
printf("Wrote audio to %s\n", name);
}
samples = 0;
channels = 0;
return ok;
}
示例2: remove_from_owner
void Gadget_Part_Impl::remove_from_owner (void)
{
// Need to guarantee the existence of the owner for the duration of this call.
Gadget_var owner = owner_;
// Weak pointers are automatically set to NULL if the object they refer to
// is deleted. We can use this fact to check that our owner still exists.
if (owner == 0)
return;
// Take all existing parts from the owner and build up a temporary list. If
// we find ourselves then we won't add ourselves to the list.
ACE_Unbounded_Queue<Gadget_Part_var> parts;
for (;;)
{
Gadget_Part_var part = owner->remove_part ();
if (part == 0)
break;
if (part != this)
parts.enqueue_tail (part);
}
// Add the remaining parts back to the gadget.
while (!parts.is_empty ())
{
Gadget_Part_var part;
parts.dequeue_head (part);
owner->add_part (part);
}
}
示例3: while
void
be_visitor_typecode_defn::
queue_reset (ACE_Unbounded_Queue <be_visitor_typecode_defn::QNode *> & queue)
{
while (!queue.is_empty ())
{
be_visitor_typecode_defn::QNode * qnode = 0;
(void) queue.dequeue_head (qnode);
delete qnode;
}
}
示例4: l
ssize_t Socket_Impl::
size_ (ACE_Time_Value const* timeout)
{
ACE_Time_Value abs_time;
if (timeout)
abs_time = ACE_OS::gettimeofday () + *timeout;
Lock l (mutex_);
while (queue_.is_empty ())
{
if (timeout)
{
if (cond_.wait (&abs_time) != -1)
break;
}
else
{
if (cond_.wait () != -1)
break;
}
return -1; // errno is already set
}
// I can't get the head of the queue without actually dequeuing
// the element.
//
Message_ptr m;
if (queue_.dequeue_head (m) == -1)
ACE_OS::abort ();
if (queue_.enqueue_head (m) == -1)
ACE_OS::abort ();
if (m->find (NoData::id) != 0)
{
errno = ENOENT;
return -1;
}
Data const* d = static_cast<Data const*>(m->find (Data::id));
return static_cast<ssize_t> (d->size ());
}