21 #include <abstractpropertytype.h> 
   22 #include "listplusplus.h" 
   25 #include <unordered_set> 
   30 template <
typename T, 
class Pred = std::equal_to<T> >
 
   45         std::lock_guard<std::mutex> lock(mutex);
 
   52         std::lock_guard<std::mutex> lock(mutex);
 
   54         auto itr = mQueue.begin();
 
   63     virtual void append(T item)
 
   65         std::lock_guard<std::mutex> lock(mutex);
 
   72         std::lock_guard<std::mutex> lock(mutex);
 
   73         removeOne(&mQueue, item);
 
   78     std::unordered_set<T,std::hash<T>, Pred> mQueue;
 
   81 template <
typename T, 
class Pred = std::equal_to<T> >
 
   88 template <
typename T, 
class Pred = std::equal_to<T> >
 
   92     typedef function<void (Queue<T, Pred> *)> AsyncQueueWatcherCallback;
 
   94         : callback(cb), mMaxQueueSize(queueSize)
 
   97         static GSourceFuncs funcs = {prepare, check, dispatch, finalize};
 
  101         watch->queue = queue;
 
  102         watch->minQueueSize = queueSize;
 
  104         gint p = G_PRIORITY_DEFAULT;
 
  107             p = G_PRIORITY_DEFAULT;
 
  113         g_source_set_priority(source, p);
 
  114         g_source_set_callback(source, 
nullptr, 
this, 
nullptr);
 
  116         g_source_attach(source, 
nullptr);
 
  117         g_source_unref(source);
 
  120     AsyncQueueWatcherCallback callback;
 
  124     AsyncQueueWatcher(){}
 
  130     static gboolean prepare(GSource *source, gint *timeout)
 
  138         return s->queue->count() > s->minQueueSize;
 
  141     static gboolean check(GSource *source)
 
  148         return s->queue->count() > s->minQueueSize;
 
  151     static gboolean dispatch(GSource *source, GSourceFunc callback, gpointer userData)
 
  160         watcher->callback(s->queue);
 
  164     static void finalize(GSource* source)
 
Definition: abstractpropertytype.h:79
Definition: asyncqueue.hpp:31
Definition: asyncqueue.hpp:89
Definition: asyncqueue.hpp:82
Priority
The Priority enum describes prority of the property type. 
Definition: abstractpropertytype.h:76
Definition: abstractpropertytype.h:80
Definition: abstractpropertytype.h:78