Commit 1c3973d7 authored by Felix Paul Kühne's avatar Felix Paul Kühne

src: split darwin threading code from the generic posix implementation

parent 5c73acee
......@@ -248,7 +248,7 @@ SOURCES_libvlc_darwin = \
darwin/dirs.c \
posix/filesystem.c \
posix/plugin.c \
posix/thread.c \
darwin/thread.c \
posix/timer.c \
darwin/specific.c \
posix/rand.c \
......
This diff is collapsed.
......@@ -49,9 +49,6 @@
#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
#endif
#ifdef __APPLE__
# include <mach/mach_init.h> /* mach_task_self in semaphores */
#endif
#if defined(__SunOS)
# include <sys/processor.h>
# include <sys/pset.h>
......@@ -445,13 +442,8 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
*/
void vlc_sem_init (vlc_sem_t *sem, unsigned value)
{
#if defined(__APPLE__)
if (unlikely(semaphore_create(mach_task_self(), sem, SYNC_POLICY_FIFO, value) != KERN_SUCCESS))
abort ();
#else
if (unlikely(sem_init (sem, 0, value)))
abort ();
#endif
}
/**
......@@ -461,17 +453,10 @@ void vlc_sem_destroy (vlc_sem_t *sem)
{
int val;
#if defined(__APPLE__)
if (likely(semaphore_destroy(mach_task_self(), *sem) == KERN_SUCCESS))
return;
val = EINVAL;
#else
if (likely(sem_destroy (sem) == 0))
return;
val = errno;
#endif
VLC_THREAD_ASSERT ("destroying semaphore");
}
......@@ -484,17 +469,10 @@ int vlc_sem_post (vlc_sem_t *sem)
{
int val;
#if defined(__APPLE__)
if (likely(semaphore_signal(*sem) == KERN_SUCCESS))
return 0;
val = EINVAL;
#else
if (likely(sem_post (sem) == 0))
return 0;
val = errno;
#endif
if (unlikely(val != EOVERFLOW))
VLC_THREAD_ASSERT ("unlocking semaphore");
......@@ -509,17 +487,10 @@ void vlc_sem_wait (vlc_sem_t *sem)
{
int val;
#if defined(__APPLE__)
if (likely(semaphore_wait(*sem) == KERN_SUCCESS))
return;
val = EINVAL;
#else
do
if (likely(sem_wait (sem) == 0))
return;
while ((val = errno) == EINTR);
#endif
VLC_THREAD_ASSERT ("locking semaphore");
}
......@@ -625,9 +596,7 @@ void vlc_threads_setup (libvlc_int_t *p_libvlc)
* just once per process. */
if (!initialized)
{
#ifndef __APPLE__
if (var_InheritBool (p_libvlc, "rt-priority"))
#endif
{
rt_offset = var_InheritInteger (p_libvlc, "rt-offset");
rt_priorities = true;
......
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