Commit 70919abc authored by Edward Wang's avatar Edward Wang

Update threads patch, again

parent 90247486
......@@ -88,7 +88,7 @@ export PLATFORM_SHORT_ARCH
export PATH=${ANDROID_NDK}/toolchains/${PATH_HOST}-${GCCVER}/prebuilt/`uname|tr A-Z a-z`-x86/bin:${PATH}
# 1/ libvlc, libvlccore and its plugins
TESTED_HASH=63c78d4
TESTED_HASH=7a216cf
if [ ! -d "vlc" ]; then
echo "VLC source not found, cloning"
git clone git://git.videolan.org/vlc.git vlc
......
From 54572a6b6a895706cabd9ca77b2007fe3055f6f3 Mon Sep 17 00:00:00 2001
From cd7c00d436350273366720bb3a4d99c1799a4d92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <funman@videolan.org>
Date: Sat, 10 Mar 2012 04:54:23 -0500
Subject: [PATCH 1/5] android: threads support
Subject: [PATCH] android: threads support
emulate pthread_cancel (based on win32 code)
TODO:
......@@ -37,7 +37,7 @@ are 100% shared with linux so it'd be useless to have 2 copies.
4 files changed, 256 insertions(+), 28 deletions(-)
diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 7fcbf25..a32375f 100644
index 4dd6335..01a8101 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -42,6 +42,15 @@
......@@ -102,10 +102,10 @@ index d053faa..52840e8 100644
vlc_mutex_unlock (&lock);
}
diff --git a/src/Makefile.am b/src/Makefile.am
index 9572480..40c71de 100644
index 8f9a237..a267412 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -198,6 +198,7 @@ libvlc_win32_rc.$(OBJEXT): libvlc_win32_rc.rc
@@ -205,6 +205,7 @@ libvlc_win32_rc.$(OBJEXT): libvlc_win32_rc.rc
EXTRA_libvlccore_la_SOURCES = \
$(SOURCES_libvlc_darwin) \
$(SOURCES_libvlc_linux) \
......@@ -113,7 +113,7 @@ index 9572480..40c71de 100644
$(SOURCES_libvlc_win32) \
$(SOURCES_libvlc_os2) \
$(SOURCES_libvlc_other) \
@@ -208,6 +209,9 @@ EXTRA_libvlccore_la_SOURCES = \
@@ -215,6 +216,9 @@ EXTRA_libvlccore_la_SOURCES = \
if HAVE_DARWIN
libvlccore_la_SOURCES += $(SOURCES_libvlc_darwin)
else
......@@ -123,7 +123,7 @@ index 9572480..40c71de 100644
if HAVE_LINUX
libvlccore_la_SOURCES += $(SOURCES_libvlc_linux)
else
@@ -226,6 +230,7 @@ endif
@@ -233,6 +237,7 @@ endif
endif
endif
endif
......@@ -131,7 +131,7 @@ index 9572480..40c71de 100644
if BUILD_HTTPD
libvlccore_la_SOURCES += $(SOURCES_libvlc_httpd)
endif
@@ -246,6 +251,18 @@ SOURCES_libvlc_darwin = \
@@ -253,6 +258,18 @@ SOURCES_libvlc_darwin = \
posix/rand.c \
$(NULL)
......@@ -151,7 +151,7 @@ index 9572480..40c71de 100644
posix/dirs.c \
posix/filesystem.c \
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 5da8805..965c516 100644
index 1fc2b67..4bdc7b5 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -1,5 +1,5 @@
......@@ -162,15 +162,15 @@ index 5da8805..965c516 100644
* Copyright (C) 1999-2009 VLC authors and VideoLAN
*
@@ -43,6 +43,8 @@
#include <pthread.h>
#include <sched.h>
#include <sys/time.h> /* gettimeofday() */
+# include <android/log.h>
+
#ifdef __linux__
# include <sys/syscall.h> /* SYS_gettid */
#endif
@@ -73,6 +75,17 @@
@@ -68,6 +70,17 @@
# define _POSIX_MONOTONIC_CLOCK (-1)
#endif
......@@ -188,7 +188,7 @@ index 5da8805..965c516 100644
#if (_POSIX_TIMERS > 0)
static unsigned vlc_clock_prec;
@@ -146,10 +159,11 @@ void vlc_trace (const char *fn, const char *file, unsigned line)
@@ -141,10 +154,11 @@ void vlc_trace (const char *fn, const char *file, unsigned line)
static inline unsigned long vlc_threadid (void)
{
......@@ -202,7 +202,7 @@ index 5da8805..965c516 100644
#else
union { pthread_t th; unsigned long int i; } v = { };
v.th = pthread_self ();
@@ -169,7 +183,7 @@ vlc_thread_fatal (const char *action, int error,
@@ -162,7 +176,7 @@ vlc_thread_fatal (const char *action, int error,
const char *function, const char *file, unsigned line)
{
int canc = vlc_savecancel ();
......@@ -211,7 +211,7 @@ index 5da8805..965c516 100644
action, error, vlc_threadid ());
vlc_trace (function, file, line);
@@ -335,6 +349,57 @@ void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
@@ -332,6 +346,57 @@ void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
VLC_THREAD_ASSERT ("unlocking mutex");
}
......@@ -269,7 +269,7 @@ index 5da8805..965c516 100644
/**
* Initializes a condition variable.
*/
@@ -428,7 +493,22 @@ void vlc_cond_broadcast (vlc_cond_t *p_condvar)
@@ -425,7 +490,22 @@ void vlc_cond_broadcast (vlc_cond_t *p_condvar)
*/
void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
{
......@@ -292,7 +292,7 @@ index 5da8805..965c516 100644
VLC_THREAD_ASSERT ("waiting on condition");
}
@@ -450,10 +530,25 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
@@ -447,10 +527,25 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
mtime_t deadline)
{
......@@ -318,7 +318,7 @@ index 5da8805..965c516 100644
return val;
}
@@ -532,10 +627,14 @@ void vlc_sem_wait (vlc_sem_t *sem)
@@ -529,10 +624,14 @@ void vlc_sem_wait (vlc_sem_t *sem)
val = EINVAL;
#else
......@@ -336,7 +336,7 @@ index 5da8805..965c516 100644
#endif
VLC_THREAD_ASSERT ("locking semaphore");
@@ -720,7 +819,22 @@ static int vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr,
@@ -719,7 +818,22 @@ static int vlc_clone_attr (vlc_thread_t *th, pthread_attr_t *attr,
assert (ret == 0); /* fails iif VLC_STACKSIZE is invalid */
#endif
......@@ -360,7 +360,7 @@ index 5da8805..965c516 100644
pthread_sigmask (SIG_SETMASK, &oldset, NULL);
pthread_attr_destroy (attr);
return ret;
@@ -761,8 +875,14 @@ int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data,
@@ -760,8 +874,14 @@ int vlc_clone (vlc_thread_t *th, void *(*entry) (void *), void *data,
*/
void vlc_join (vlc_thread_t handle, void **result)
{
......@@ -376,7 +376,7 @@ index 5da8805..965c516 100644
}
/**
@@ -842,10 +962,25 @@ int vlc_set_priority (vlc_thread_t th, int priority)
@@ -841,10 +961,25 @@ int vlc_set_priority (vlc_thread_t th, int priority)
*/
void vlc_cancel (vlc_thread_t thread_id)
{
......@@ -406,7 +406,7 @@ index 5da8805..965c516 100644
}
/**
@@ -858,11 +993,13 @@ void vlc_cancel (vlc_thread_t thread_id)
@@ -857,11 +992,13 @@ void vlc_cancel (vlc_thread_t thread_id)
*/
int vlc_savecancel (void)
{
......@@ -424,7 +424,7 @@ index 5da8805..965c516 100644
}
/**
@@ -872,18 +1009,19 @@ int vlc_savecancel (void)
@@ -871,18 +1008,19 @@ int vlc_savecancel (void)
*/
void vlc_restorecancel (int state)
{
......@@ -450,7 +450,7 @@ index 5da8805..965c516 100644
#endif
}
@@ -896,13 +1034,48 @@ void vlc_restorecancel (int state)
@@ -895,13 +1033,48 @@ void vlc_restorecancel (int state)
*/
void vlc_testcancel (void)
{
......@@ -502,7 +502,7 @@ index 5da8805..965c516 100644
}
/**
@@ -979,8 +1152,23 @@ void msleep (mtime_t delay)
@@ -978,8 +1151,23 @@ void msleep (mtime_t delay)
while (clock_nanosleep (vlc_clock_id, 0, &ts, &ts) == EINTR);
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment