Author: fejj
Date: 2008-01-17 15:03:01 -0500 (Thu, 17 Jan 2008)
New Revision: 93192
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/list.cpp
trunk/moon/src/list.h
Log:
2008-01-17 Jeffrey Stedfast <[EMAIL PROTECTED]>
* list.cpp (Wait): Added.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2008-01-17 20:02:26 UTC (rev 93191)
+++ trunk/moon/src/ChangeLog 2008-01-17 20:03:01 UTC (rev 93192)
@@ -1,5 +1,9 @@
2008-01-17 Jeffrey Stedfast <[EMAIL PROTECTED]>
+ * list.cpp (Wait): Added.
+
+2008-01-17 Jeffrey Stedfast <[EMAIL PROTECTED]>
+
* mplayer2.cpp: Updated for MediaFrame changes.
* pipeline-ffmpeg.cc: Updated for MediaFrame changes.
Modified: trunk/moon/src/list.cpp
===================================================================
--- trunk/moon/src/list.cpp 2008-01-17 20:02:26 UTC (rev 93191)
+++ trunk/moon/src/list.cpp 2008-01-17 20:03:01 UTC (rev 93192)
@@ -339,12 +339,14 @@
Queue::Queue ()
{
pthread_mutex_init (&lock, NULL);
+ pthread_cond_init (&cond, NULL);
list = new List ();
}
Queue::~Queue ()
{
pthread_mutex_destroy (&lock);
+ pthread_cond_destroy (&cond);
delete list;
}
@@ -385,6 +387,7 @@
{
Lock ();
list->Append (node);
+ pthread_cond_signal (&cond);
Unlock ();
}
@@ -413,6 +416,15 @@
pthread_mutex_unlock (&lock);
}
+void
+Queue::Wait ()
+{
+ if (pthread_mutex_trylock (&lock) != 0)
+ pthread_cond_wait (&cond, &lock);
+
+ pthread_mutex_unlock (&lock);
+}
+
List *
Queue::LinkedList ()
{
Modified: trunk/moon/src/list.h
===================================================================
--- trunk/moon/src/list.h 2008-01-17 20:02:26 UTC (rev 93191)
+++ trunk/moon/src/list.h 2008-01-17 20:03:01 UTC (rev 93192)
@@ -70,6 +70,7 @@
class Queue {
protected:
pthread_mutex_t lock;
+ pthread_cond_t cond;
List *list;
public:
@@ -90,6 +91,8 @@
void Lock ();
void Unlock ();
+ void Wait ();
+
// accessing the internal linked list directly requires manual
Locking/Unlocking.
List *LinkedList ();
};
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches