Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2018-01-06 Thread James Almer
On 1/7/2018 12:07 AM, KO Myung-Hun wrote:
> Ping ?
> 
> KO Myung-Hun wrote:
>> ---
>>  compat/os2threads.h | 14 --
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>

Pushed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2018-01-06 Thread KO Myung-Hun
Ping ?

KO Myung-Hun wrote:
> ---
>  compat/os2threads.h | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/compat/os2threads.h b/compat/os2threads.h
> index 40a119ffe1..2177a033ec 100644
> --- a/compat/os2threads.h
> +++ b/compat/os2threads.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2011 KO Myung-Hun 
> + * Copyright (c) 2011-2017 KO Myung-Hun 
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -46,9 +46,11 @@ typedef struct {
>  
>  typedef void pthread_attr_t;
>  
> -typedef HMTX pthread_mutex_t;
> +typedef _fmutex pthread_mutex_t;
>  typedef void pthread_mutexattr_t;
>  
> +#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
> +
>  typedef struct {
>  HEV event_sem;
>  HEV ack_sem;
> @@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t 
> thread, void **value_ptr)
>  static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
> const pthread_mutexattr_t 
> *attr)
>  {
> -DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
> +_fmutex_create(mutex, 0);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
>  {
> -DosCloseMutexSem(*(PHMTX)mutex);
> +_fmutex_close(mutex);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
>  {
> -DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
> +_fmutex_request(mutex, 0);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
>  {
> -DosReleaseMutexSem(*(PHMTX)mutex);
> +_fmutex_release(mutex);
>  
>  return 0;
>  }

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2017-12-28 Thread KO Myung-Hun
Hi/2.

wm4 wrote:
> On Thu, 28 Dec 2017 22:03:56 +0900
> KO Myung-Hun  wrote:
> 
>> ---
>>  compat/os2threads.h | 14 --
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/compat/os2threads.h b/compat/os2threads.h
>> index 40a119ffe1..2177a033ec 100644
>> --- a/compat/os2threads.h
>> +++ b/compat/os2threads.h
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2011 KO Myung-Hun 
>> + * Copyright (c) 2011-2017 KO Myung-Hun 
>>   *
>>   * This file is part of FFmpeg.
>>   *
>> @@ -46,9 +46,11 @@ typedef struct {
>>  
>>  typedef void pthread_attr_t;
>>  
>> -typedef HMTX pthread_mutex_t;
>> +typedef _fmutex pthread_mutex_t;
>>  typedef void pthread_mutexattr_t;
>>  
>> +#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
>> +
>>  typedef struct {
>>  HEV event_sem;
>>  HEV ack_sem;
>> @@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t 
>> thread, void **value_ptr)
>>  static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
>> const pthread_mutexattr_t 
>> *attr)
>>  {
>> -DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
>> +_fmutex_create(mutex, 0);
>>  
>>  return 0;
>>  }
>>  
>>  static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
>>  {
>> -DosCloseMutexSem(*(PHMTX)mutex);
>> +_fmutex_close(mutex);
>>  
>>  return 0;
>>  }
>>  
>>  static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
>>  {
>> -DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
>> +_fmutex_request(mutex, 0);
>>  
>>  return 0;
>>  }
>>  
>>  static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
>>  {
>> -DosReleaseMutexSem(*(PHMTX)mutex);
>> +_fmutex_release(mutex);
>>  
>>  return 0;
>>  }
> 
> LGTM. Does this actually switch to futex-like light weight mutexes? (I
> don't know anything about OS/2, but it does sound like PHMTX was the
> equivalent of a win32 HANDLE mutex kernel object, that required kernel
> entry on each lock/unlock, while _fmutex is possibly like Vista+ SRWs.)

_fmutex is not futex-like light-weight mutex. Unlike HMTX, however,
_fmutex supports static mutexes.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2017-12-28 Thread wm4
On Thu, 28 Dec 2017 22:03:56 +0900
KO Myung-Hun  wrote:

> ---
>  compat/os2threads.h | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/compat/os2threads.h b/compat/os2threads.h
> index 40a119ffe1..2177a033ec 100644
> --- a/compat/os2threads.h
> +++ b/compat/os2threads.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2011 KO Myung-Hun 
> + * Copyright (c) 2011-2017 KO Myung-Hun 
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -46,9 +46,11 @@ typedef struct {
>  
>  typedef void pthread_attr_t;
>  
> -typedef HMTX pthread_mutex_t;
> +typedef _fmutex pthread_mutex_t;
>  typedef void pthread_mutexattr_t;
>  
> +#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
> +
>  typedef struct {
>  HEV event_sem;
>  HEV ack_sem;
> @@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t 
> thread, void **value_ptr)
>  static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
> const pthread_mutexattr_t 
> *attr)
>  {
> -DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
> +_fmutex_create(mutex, 0);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
>  {
> -DosCloseMutexSem(*(PHMTX)mutex);
> +_fmutex_close(mutex);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
>  {
> -DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
> +_fmutex_request(mutex, 0);
>  
>  return 0;
>  }
>  
>  static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
>  {
> -DosReleaseMutexSem(*(PHMTX)mutex);
> +_fmutex_release(mutex);
>  
>  return 0;
>  }

LGTM. Does this actually switch to futex-like light weight mutexes? (I
don't know anything about OS/2, but it does sound like PHMTX was the
equivalent of a win32 HANDLE mutex kernel object, that required kernel
entry on each lock/unlock, while _fmutex is possibly like Vista+ SRWs.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] compat/os2threads: support static mutexes

2017-12-28 Thread KO Myung-Hun
---
 compat/os2threads.h | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/compat/os2threads.h b/compat/os2threads.h
index 40a119ffe1..2177a033ec 100644
--- a/compat/os2threads.h
+++ b/compat/os2threads.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 KO Myung-Hun 
+ * Copyright (c) 2011-2017 KO Myung-Hun 
  *
  * This file is part of FFmpeg.
  *
@@ -46,9 +46,11 @@ typedef struct {
 
 typedef void pthread_attr_t;
 
-typedef HMTX pthread_mutex_t;
+typedef _fmutex pthread_mutex_t;
 typedef void pthread_mutexattr_t;
 
+#define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
+
 typedef struct {
 HEV event_sem;
 HEV ack_sem;
@@ -98,28 +100,28 @@ static av_always_inline int pthread_join(pthread_t thread, 
void **value_ptr)
 static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *attr)
 {
-DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE);
+_fmutex_create(mutex, 0);
 
 return 0;
 }
 
 static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
 {
-DosCloseMutexSem(*(PHMTX)mutex);
+_fmutex_close(mutex);
 
 return 0;
 }
 
 static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
 {
-DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
+_fmutex_request(mutex, 0);
 
 return 0;
 }
 
 static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
 {
-DosReleaseMutexSem(*(PHMTX)mutex);
+_fmutex_release(mutex);
 
 return 0;
 }
-- 
2.13.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel