24 #include <interface/message_queue.h>
25 #include <interface/message.h>
27 #include <core/threading/mutex.h>
28 #include <core/exceptions/software.h>
45 :
Exception(
"Message already enqueued in another MessageQueue.")
65 __mutex =
new Mutex();
85 msg_list_t *l = __list;
111 if ( __list == NULL ) {
112 __list = (msg_list_t *)malloc(
sizeof(msg_list_t));
115 __list->msg_id = msg->
id();
118 msg_list_t *l = (msg_list_t *)malloc(
sizeof(msg_list_t));
121 l->msg_id = msg->
id();
144 throw NotLockedException(
"Message queue must be locked to insert messages after iterator.");
146 if ( it.cur == NULL ) {
153 msg_list_t *l = (msg_list_t *)malloc(
sizeof(msg_list_t));
154 l->next = it.cur->next;
156 l->msg_id = msg->
id();
158 if ( l->next == NULL ) {
171 msg_list_t *l = __list;
172 msg_list_t *p = NULL;
174 if ( l->msg == msg ) {
193 msg_list_t *l = __list;
194 msg_list_t *p = NULL;
196 if ( l->msg_id == msg_id ) {
238 msg_list_t *l = __list;
256 bool rv = ( __list == NULL );
319 remove(__list, NULL);
444 for (
unsigned int j = 0; (cur != NULL) && (j < i); ++j) {
460 for (
unsigned int j = 0; (cur != NULL) && (j < i); ++j) {
475 return (cur == c.cur);
487 return (cur != c.cur);
499 return ( cur != NULL ) ? cur->msg : NULL;
533 if ( cur == NULL )
return 0;