Commit 86df8c04 authored by KO Myung-Hun's avatar KO Myung-Hun Committed by Rémi Denis-Courmont

Implement thread support for OS/2

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent de6f5699
...@@ -476,6 +476,13 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */ ...@@ -476,6 +476,13 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */
# include <windows.h> # include <windows.h>
#endif #endif
#ifdef __OS2__
# define OS2EMX_PLAIN_CHAR
# define INCL_BASE
# define INCL_PM
# include <os2.h>
#endif
#include "vlc_mtime.h" #include "vlc_mtime.h"
#include "vlc_threads.h" #include "vlc_threads.h"
......
...@@ -38,6 +38,11 @@ ...@@ -38,6 +38,11 @@
#elif defined( WIN32 ) #elif defined( WIN32 )
# include <process.h> /* Win32 API */ # include <process.h> /* Win32 API */
#elif defined( __OS2__ ) /* OS/2 API */
# include <errno.h>
# define pthread_sigmask sigprocmask
#else /* pthreads (like Linux & BSD) */ #else /* pthreads (like Linux & BSD) */
# define LIBVLC_USE_PTHREAD 1 # define LIBVLC_USE_PTHREAD 1
# define LIBVLC_USE_PTHREAD_CANCEL 1 # define LIBVLC_USE_PTHREAD_CANCEL 1
...@@ -90,6 +95,14 @@ ...@@ -90,6 +95,14 @@
# define VLC_THREAD_PRIORITY_HIGHEST \ # define VLC_THREAD_PRIORITY_HIGHEST \
THREAD_PRIORITY_TIME_CRITICAL THREAD_PRIORITY_TIME_CRITICAL
#elif defined(__OS2__)
# define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_INPUT MAKESHORT( PRTYD_MAXIMUM / 2, PRTYC_REGULAR )
# define VLC_THREAD_PRIORITY_AUDIO MAKESHORT( PRTYD_MAXIMUM, PRTYC_REGULAR )
# define VLC_THREAD_PRIORITY_VIDEO 0
# define VLC_THREAD_PRIORITY_OUTPUT MAKESHORT( PRTYD_MAXIMUM / 2, PRTYC_REGULAR )
# define VLC_THREAD_PRIORITY_HIGHEST MAKESHORT( 0, PRTYC_TIMECRITICAL )
#else #else
# define VLC_THREAD_PRIORITY_LOW 0 # define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_INPUT 0 # define VLC_THREAD_PRIORITY_INPUT 0
...@@ -161,6 +174,56 @@ typedef struct ...@@ -161,6 +174,56 @@ typedef struct
typedef struct vlc_threadvar *vlc_threadvar_t; typedef struct vlc_threadvar *vlc_threadvar_t;
typedef struct vlc_timer *vlc_timer_t; typedef struct vlc_timer *vlc_timer_t;
#elif defined( __OS2__ )
typedef struct vlc_thread *vlc_thread_t;
typedef struct
{
bool dynamic;
union
{
struct
{
bool locked;
unsigned long contention;
};
HMTX hmtx;
};
} vlc_mutex_t;
#define VLC_STATIC_MUTEX { false, { { false, 0 } } }
typedef struct
{
HEV hev;
unsigned clock;
} vlc_cond_t;
#define VLC_STATIC_COND { 0, 0 }
typedef struct
{
HEV hev;
HMTX wait_mutex;
HMTX count_mutex;
int count;
} vlc_sem_t;
typedef struct
{
vlc_mutex_t mutex;
vlc_cond_t wait;
unsigned long readers;
unsigned long writers;
int writer;
} vlc_rwlock_t;
#define VLC_STATIC_RWLOCK \
{ VLC_STATIC_MUTEX, VLC_STATIC_COND, 0, 0, 0 }
typedef struct vlc_threadvar *vlc_threadvar_t;
typedef struct vlc_timer *vlc_timer_t;
#endif #endif
#if defined( WIN32 ) && !defined ETIMEDOUT #if defined( WIN32 ) && !defined ETIMEDOUT
......
...@@ -197,6 +197,7 @@ EXTRA_libvlccore_la_SOURCES = \ ...@@ -197,6 +197,7 @@ EXTRA_libvlccore_la_SOURCES = \
$(SOURCES_libvlc_darwin) \ $(SOURCES_libvlc_darwin) \
$(SOURCES_libvlc_linux) \ $(SOURCES_libvlc_linux) \
$(SOURCES_libvlc_win32) \ $(SOURCES_libvlc_win32) \
$(SOURCES_libvlc_os2) \
$(SOURCES_libvlc_other) \ $(SOURCES_libvlc_other) \
$(SOURCES_libvlc_httpd) \ $(SOURCES_libvlc_httpd) \
$(SOURCES_libvlc_sout) \ $(SOURCES_libvlc_sout) \
...@@ -217,12 +218,16 @@ else ...@@ -217,12 +218,16 @@ else
if HAVE_SYMBIAN if HAVE_SYMBIAN
#libvlccore_la_SOURCES += $(SOURCES_libvlc_symbian) #libvlccore_la_SOURCES += $(SOURCES_libvlc_symbian)
else else
if HAVE_OS2
libvlccore_la_SOURCES += $(SOURCES_libvlc_os2)
else
libvlccore_la_SOURCES += $(SOURCES_libvlc_other) libvlccore_la_SOURCES += $(SOURCES_libvlc_other)
endif endif
endif endif
endif endif
endif endif
endif endif
endif
if BUILD_HTTPD if BUILD_HTTPD
libvlccore_la_SOURCES += $(SOURCES_libvlc_httpd) libvlccore_la_SOURCES += $(SOURCES_libvlc_httpd)
endif endif
...@@ -271,6 +276,14 @@ SOURCES_libvlc_symbian = \ ...@@ -271,6 +276,14 @@ SOURCES_libvlc_symbian = \
win32/plugin.c \ win32/plugin.c \
$(NULL) $(NULL)
SOURCES_libvlc_os2 = \
posix/dirs.c \
misc/atomic.c \
posix/filesystem.c \
os2/thread.c \
posix/specific.c \
$(NULL)
SOURCES_libvlc_other = \ SOURCES_libvlc_other = \
posix/dirs.c \ posix/dirs.c \
misc/atomic.c \ misc/atomic.c \
......
This diff is collapsed.
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