CVS Root: /cvs/gstreamer
Module: gst-openmax
Changes by: felipec
Date: Thu Nov 20 2008 17:00:10 UTC
Log message:
Add new semaphore utility.
Modified files:
util : Makefile.am
Added files:
util : sem.c sem.h
Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/util/Makefile.am.diff?r1=1.1&r2=1.2
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/util/sem.c?rev=1.1&content-type=text/vnd.viewcvs-markup
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/util/sem.h?rev=1.1&content-type=text/vnd.viewcvs-markup
====Begin Diffs====
Index: Makefile.am
===================================================================
RCS file: /cvs/gstreamer/gst-openmax/util/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am 5 Jun 2008 16:03:02 -0000 1.1
+++ Makefile.am 20 Nov 2008 16:59:56 -0000 1.2
@@ -1,6 +1,7 @@
noinst_LTLIBRARIES = libutil.la
-libutil_la_SOURCES = async_queue.c async_queue.h
+libutil_la_SOURCES = async_queue.c async_queue.h \
+ sem.c sem.h
libutil_la_CFLAGS = $(GTHREAD_CFLAGS)
libutil_la_LIBADD = $(GTHREAD_LIBS)
--- NEW FILE: sem.c ---
/*
* Copyright (C) 2008 Nokia Corporation.
*
* Author: Felipe Contreras <[email protected]>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <glib.h>
#include "sem.h"
GSem *
g_sem_new (void)
{
GSem *sem;
sem = g_new (GSem, 1);
sem->condition = g_cond_new ();
sem->mutex = g_mutex_new ();
sem->counter = 0;
return sem;
}
void
g_sem_free (GSem *sem)
g_cond_free (sem->condition);
g_mutex_free (sem->mutex);
g_free (sem);
g_sem_down (GSem *sem)
g_mutex_lock (sem->mutex);
while (sem->counter == 0)
{
g_cond_wait (sem->condition, sem->mutex);
}
sem->counter--;
g_mutex_unlock (sem->mutex);
g_sem_up (GSem *sem)
sem->counter++;
g_cond_signal (sem->condition);
--- NEW FILE: sem.h ---
#ifndef SEM_H
#define SEM_H
typedef struct GSem GSem;
struct GSem
GCond *condition;
GMutex *mutex;
gint counter;
};
GSem *g_omx_sem_new (void);
void g_omx_sem_free (GSem *sem);
void g_omx_sem_down (GSem *sem);
void g_omx_sem_up (GSem *sem);
#endif /* SEM_H */
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.