File: Poco.TimedNotificationQueue.html

package info (click to toggle)
poco-doc 1.3.6-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 10,076 kB
  • ctags: 9,611
  • sloc: makefile: 31
file content (110 lines) | stat: -rw-r--r-- 9,823 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::TimedNotificationQueue</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class TimedNotificationQueue</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Notifications<br />
<b>Header:</b> Poco/TimedNotificationQueue.h</p>
<h2>Description</h2>
<div class="description">
<p>A <a href="Poco.TimedNotificationQueue.html" title="class Poco::TimedNotificationQueue">TimedNotificationQueue</a> object provides a way to implement timed, asynchronous notifications. This is especially useful for sending notifications from one thread to another, for example from a background thread to  the main (user interface) thread.  </p>
<p>The <a href="Poco.TimedNotificationQueue.html" title="class Poco::TimedNotificationQueue">TimedNotificationQueue</a> is quite similar to the <a href="Poco.NotificationQueue.html" title="class Poco::NotificationQueue">NotificationQueue</a> class. The only difference to <a href="Poco.NotificationQueue.html" title="class Poco::NotificationQueue">NotificationQueue</a> is that each <a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> is tagged with a <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>. When inserting a <a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> into the queue, the <a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> is inserted according to the given <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>, with  lower <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> values being inserted before higher ones. </p>
<p>Notifications are dequeued in order of their timestamps. </p>
<p><a href="Poco.TimedNotificationQueue.html" title="class Poco::TimedNotificationQueue">TimedNotificationQueue</a> has some restrictions regarding multithreaded use. While multiple threads may enqueue notifications, only one thread at a time may dequeue notifications from the queue. </p>
<p>If two threads try to dequeue a notification simultaneously, the results are undefined. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.TimedNotificationQueue.html#10981" title="Poco::TimedNotificationQueue::clear()">clear</a>, <a href="Poco.TimedNotificationQueue.html#10975" title="Poco::TimedNotificationQueue::dequeueNotification()">dequeueNotification</a>, <a href="Poco.TimedNotificationQueue.html#10983" title="Poco::TimedNotificationQueue::dequeueOne()">dequeueOne</a>, <a href="Poco.TimedNotificationQueue.html#10979" title="Poco::TimedNotificationQueue::empty()">empty</a>, <a href="Poco.TimedNotificationQueue.html#10972" title="Poco::TimedNotificationQueue::enqueueNotification()">enqueueNotification</a>, <a href="Poco.TimedNotificationQueue.html#10980" title="Poco::TimedNotificationQueue::size()">size</a>, <a href="Poco.TimedNotificationQueue.html#10985" title="Poco::TimedNotificationQueue::wait()">wait</a>, <a href="Poco.TimedNotificationQueue.html#10976" title="Poco::TimedNotificationQueue::waitDequeueNotification()">waitDequeueNotification</a></p>
<h2>Types</h2>
<h3><a name="10982">NfQueue</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">typedef std::multimap &lt; <a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a>, <a href="Poco.Notification.html#8786" title="Poco::Notification::Ptr">Notification::Ptr</a> &gt; <a href="Poco.TimedNotificationQueue.html#10982" title="Poco::TimedNotificationQueue::NfQueue">NfQueue</a>;</p>
<div class="description">
<p></p>
</div>
<h2>Constructors</h2>
<h3><a name="10970">TimedNotificationQueue</a></h3>
<p class="decl"><a href="Poco.TimedNotificationQueue.html" title="class Poco::TimedNotificationQueue">TimedNotificationQueue</a>();</p>
<div class="description">
<p>Creates the <a href="Poco.TimedNotificationQueue.html" title="class Poco::TimedNotificationQueue">TimedNotificationQueue</a>. </p>
</div>
<h2>Destructor</h2>
<h3><a name="10971">~TimedNotificationQueue</a></h3>
<p class="decl">~<a href="Poco.TimedNotificationQueue.html" title="class Poco::TimedNotificationQueue">TimedNotificationQueue</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.TimedNotificationQueue.html" title="class Poco::TimedNotificationQueue">TimedNotificationQueue</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="10981">clear</a></h3>
<p class="decl">void clear();</p>
<div class="description">
<p>Removes all notifications from the queue. </p>
<p>Calling <a href="Poco.TimedNotificationQueue.html#10981" title="Poco::TimedNotificationQueue::clear()">clear</a>() while another thread executes one of the dequeue member functions will result in undefined behavior. </p>
</div>
<h3><a name="10975">dequeueNotification</a></h3>
<p class="decl"><a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> * dequeueNotification();</p>
<div class="description">
<p>Dequeues the next pending notification with a timestamp less than or equal to the current time. Returns 0 (null) if no notification is available. The caller gains ownership of the notification and is expected to release it when done with it. </p>
<p>It is highly recommended that the result is immediately assigned to a <a href="Poco.Notification.html#8786" title="Poco::Notification::Ptr">Notification::Ptr</a>, to avoid potential memory management issues. </p>
</div>
<h3><a name="10979">empty</a></h3>
<p class="decl">bool empty() const;</p>
<div class="description">
<p>Returns true if and only if the queue is empty. </p>
</div>
<h3><a name="10972">enqueueNotification</a></h3>
<p class="decl">void enqueueNotification(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Notification.html#8786" title="Poco::Notification::Ptr">Notification::Ptr</a> pNotification,<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Timestamp.html" title="class Poco::Timestamp">Timestamp</a> timestamp<br />);</p>
<div class="description">
<p>Enqueues the given notification by adding it to the queue according to the given timestamp. Lower timestamp values are inserted before higher ones. The queue takes ownership of the notification, thus a call like </p>
<pre>notificationQueue.enqueueNotification(new MyNotification, someTime);
</pre>
<p>does not result in a memory leak. </p>
</div>
<h3><a name="10980">size</a></h3>
<p class="decl">int size() const;</p>
<div class="description">
<p>Returns the number of notifications in the queue. </p>
</div>
<h3><a name="10976">waitDequeueNotification</a></h3>
<p class="decl"><a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> * waitDequeueNotification();</p>
<div class="description">
<p>Dequeues the next pending notification. If no notification is available, waits for a notification to be enqueued.  The caller gains ownership of the notification and is expected to release it when done with it. </p>
<p>It is highly recommended that the result is immediately assigned to a <a href="Poco.Notification.html#8786" title="Poco::Notification::Ptr">Notification::Ptr</a>, to avoid potential memory management issues. </p>
</div>
<h3><a name="10977">waitDequeueNotification</a></h3>
<p class="decl"><a href="Poco.Notification.html" title="class Poco::Notification">Notification</a> * waitDequeueNotification(<br />&nbsp;&nbsp;&nbsp;&nbsp;long milliseconds<br />);</p>
<div class="description">
<p>Dequeues the next pending notification. If no notification is available, waits for a notification to be enqueued up to the specified time. Returns 0 (null) if no notification is available. The caller gains ownership of the notification and is expected to release it when done with it. </p>
<p>It is highly recommended that the result is immediately assigned to a <a href="Poco.Notification.html#8786" title="Poco::Notification::Ptr">Notification::Ptr</a>, to avoid potential memory management issues. </p>
</div>
<h3><a name="10983">dequeueOne</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Notification.html#8786" title="Poco::Notification::Ptr">Notification::Ptr</a> dequeueOne(<br />&nbsp;&nbsp;&nbsp;&nbsp;NfQueue::iterator &amp; it<br />);</p>
<div class="description">
<p></p>
</div>
<h3><a name="10985">wait</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool wait(<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href="Poco.Timestamp.html#11151" title="Poco::Timestamp::TimeDiff">Timestamp::TimeDiff</a> interval<br />);</p>
<div class="description">
<p></p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>