[PATCH] [common] Added some other pthread calls to linux os abstraction layer


Ian Bell <IBell@...>
 

commit cd1c6ae95f2d709136b687f4c40d11a446d4990c

Author: Ian Bell <IBell@...>

Date:   Thu May 17 21:38:59 2012 +0100

 

    [common] Added some other pthread calls to linux os abstraction layer

    Signed-off-by: Ian Bell <IBell@...>

 

diff --git a/common/c_cpp/src/c/linux/port.h b/common/c_cpp/src/c/linux/port.h

index b40b4fa..a94ac7f 100644

--- a/common/c_cpp/src/c/linux/port.h

+++ b/common/c_cpp/src/c/linux/port.h

@@ -58,6 +58,7 @@ extern "C"

/* PTHREAD static locks are easy */

typedef pthread_mutex_t wthread_static_mutex_t;

#define WSTATIC_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

+#define WTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE

#define wthread_static_mutex_lock(x) pthread_mutex_lock((x))

#define wthread_static_mutex_unlock(x) pthread_mutex_unlock((x))

@@ -135,6 +136,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

#define wthread_cond_signal     pthread_cond_signal

#define wthread_cond_destroy    pthread_cond_destroy

#define wthread_cond_wait     pthread_cond_wait

+#define wthread_cond_broadcast        pthread_cond_broadcast

 #define wthread_spinlock_t     pthread_spinlock_t   

 #define wthread_spin_init      pthread_spin_init

@@ -147,6 +149,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

 #define wthread_mutexattr_t pthread_mutexattr_t

#define wthread_mutexattr_init pthread_mutexattr_init

+#define wthread_mutexattr_destroy pthread_mutexattr_destroy

#define wthread_mutexattr_settype pthread_mutexattr_settype

 #define wGetCurrentThreadId     pthread_self



Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


Mike Schonberg <mschonberg@...>
 

Ian,

I believe that we need equivalents defined in common/.../windows/lock.h.

On Fri, 18 May 2012, Ian Bell wrote:


commit cd1c6ae95f2d709136b687f4c40d11a446d4990c

Author: Ian Bell <IBell@nyx.com>

Date: Thu May 17 21:38:59 2012 +0100



[common] Added some other pthread calls to linux os abstraction layer

Signed-off-by: Ian Bell <IBell@nyx.com>



diff --git a/common/c_cpp/src/c/linux/port.h b/common/c_cpp/src/c/linux/port.h

index b40b4fa..a94ac7f 100644

--- a/common/c_cpp/src/c/linux/port.h

+++ b/common/c_cpp/src/c/linux/port.h

@@ -58,6 +58,7 @@ extern "C"

/* PTHREAD static locks are easy */

typedef pthread_mutex_t wthread_static_mutex_t;

#define WSTATIC_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

+#define WTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE
This can be a no-op as Windows condition variables are always recursive.


#define wthread_static_mutex_lock(x) pthread_mutex_lock((x))

#define wthread_static_mutex_unlock(x) pthread_mutex_unlock((x))

@@ -135,6 +136,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

#define wthread_cond_signal pthread_cond_signal

#define wthread_cond_destroy pthread_cond_destroy

#define wthread_cond_wait pthread_cond_wait

+#define wthread_cond_broadcast pthread_cond_broadcast
We may need to change the implementation to use Windows condition variables or
or change the Event to be manual reset and add locking/and a condition variable
to ensure the desired number of threads run (one or all).

#define wthread_spinlock_t pthread_spinlock_t

#define wthread_spin_init pthread_spin_init

@@ -147,6 +149,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

#define wthread_mutexattr_t pthread_mutexattr_t

#define wthread_mutexattr_init pthread_mutexattr_init

+#define wthread_mutexattr_destroy pthread_mutexattr_destroy
This will be a no-op as well.

Regards,
-Mike


#define wthread_mutexattr_settype pthread_mutexattr_settype

#define wGetCurrentThreadId pthread_self


______________________________________________________________________________________________________________________________________________________________________________________________________________
Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and
delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please consider the environment before printing this email.

Visit our website at http://www.nyse.com

****************************************************

Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.


Ian Bell <IBell@...>
 

Hi Mike

As you have pointed out below adding this to windows is a bit less straightforward and requires a bit more testing. I was going to bundle the windows code together with some other patches i have for the windows layer to cut down on the testing effort.

To this end iI have also been adding some unittests to the common folder to facilitate testing of these components separately from mama.

As i have not yet submitted any patches which require this feature to be present in the abstraction layer i can hold this patch until such time as the windows version is ready if you prefer.

Ian

-----Original Message-----
From: Mike Schonberg
Sent: 23 May 2012 01:32
To: Ian Bell; openmama-dev@lists.openmama.org
Subject: RE: [PATCH] [common] Added some other pthread calls to linux os abstraction layer


Ian,

I believe that we need equivalents defined in common/.../windows/lock.h.

On Fri, 18 May 2012, Ian Bell wrote:


commit cd1c6ae95f2d709136b687f4c40d11a446d4990c

Author: Ian Bell <IBell@nyx.com>

Date: Thu May 17 21:38:59 2012 +0100



[common] Added some other pthread calls to linux os abstraction
layer

Signed-off-by: Ian Bell <IBell@nyx.com>



diff --git a/common/c_cpp/src/c/linux/port.h
b/common/c_cpp/src/c/linux/port.h

index b40b4fa..a94ac7f 100644

--- a/common/c_cpp/src/c/linux/port.h

+++ b/common/c_cpp/src/c/linux/port.h

@@ -58,6 +58,7 @@ extern "C"

/* PTHREAD static locks are easy */

typedef pthread_mutex_t wthread_static_mutex_t;

#define WSTATIC_MUTEX_INITIALIZER
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

+#define WTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE
This can be a no-op as Windows condition variables are always recursive.


#define wthread_static_mutex_lock(x) pthread_mutex_lock((x))

#define wthread_static_mutex_unlock(x) pthread_mutex_unlock((x))

@@ -135,6 +136,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

#define wthread_cond_signal pthread_cond_signal

#define wthread_cond_destroy pthread_cond_destroy

#define wthread_cond_wait pthread_cond_wait

+#define wthread_cond_broadcast pthread_cond_broadcast
We may need to change the implementation to use Windows condition variables or or change the Event to be manual reset and add locking/and a condition variable to ensure the desired number of threads run (one or all).

#define wthread_spinlock_t pthread_spinlock_t

#define wthread_spin_init pthread_spin_init

@@ -147,6 +149,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

#define wthread_mutexattr_t pthread_mutexattr_t

#define wthread_mutexattr_init pthread_mutexattr_init

+#define wthread_mutexattr_destroy pthread_mutexattr_destroy
This will be a no-op as well.

Regards,
-Mike


#define wthread_mutexattr_settype pthread_mutexattr_settype

#define wGetCurrentThreadId pthread_self


______________________________________________________________________
______________________________________________________________________
__________________________________________________________________
Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


Michael Schonberg <mschonberg@...>
 

On Wed, 23 May 2012, Ian Bell wrote:

Hi Mike

As you have pointed out below adding this to windows is a bit less
straightforward and requires a bit more testing. I was going to bundle the
windows code together with some other patches i have for the windows layer to
cut down on the testing effort.
That is fine. As long as it makes it in.

To this end iI have also been adding some unittests to the common folder to
facilitate testing of these components separately from mama.

As i have not yet submitted any patches which require this feature to be
present in the abstraction layer i can hold this patch until such time as the
windows version is ready if you prefer.
I will hold the patch back until you submit the windows changes, and push them
together.

I plan on pushing your other patches to a "next" branch for pending changes, and
I will leave this one out until the Windows changes are ready.

Regards,
-Mike


Ian

-----Original Message-----
From: Mike Schonberg
Sent: 23 May 2012 01:32
To: Ian Bell; openmama-dev@lists.openmama.org
Subject: RE: [PATCH] [common] Added some other pthread calls to linux os abstraction layer


Ian,

I believe that we need equivalents defined in common/.../windows/lock.h.

On Fri, 18 May 2012, Ian Bell wrote:


commit cd1c6ae95f2d709136b687f4c40d11a446d4990c

Author: Ian Bell <IBell@nyx.com>

Date: Thu May 17 21:38:59 2012 +0100



[common] Added some other pthread calls to linux os abstraction
layer

Signed-off-by: Ian Bell <IBell@nyx.com>



diff --git a/common/c_cpp/src/c/linux/port.h
b/common/c_cpp/src/c/linux/port.h

index b40b4fa..a94ac7f 100644

--- a/common/c_cpp/src/c/linux/port.h

+++ b/common/c_cpp/src/c/linux/port.h

@@ -58,6 +58,7 @@ extern "C"

/* PTHREAD static locks are easy */

typedef pthread_mutex_t wthread_static_mutex_t;

#define WSTATIC_MUTEX_INITIALIZER
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

+#define WTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE
This can be a no-op as Windows condition variables are always recursive.


#define wthread_static_mutex_lock(x) pthread_mutex_lock((x))

#define wthread_static_mutex_unlock(x) pthread_mutex_unlock((x))

@@ -135,6 +136,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

#define wthread_cond_signal pthread_cond_signal

#define wthread_cond_destroy pthread_cond_destroy

#define wthread_cond_wait pthread_cond_wait

+#define wthread_cond_broadcast pthread_cond_broadcast
We may need to change the implementation to use Windows condition variables or or change the Event to be manual reset and add locking/and a condition variable to ensure the desired number of threads run (one or all).

#define wthread_spinlock_t pthread_spinlock_t

#define wthread_spin_init pthread_spin_init

@@ -147,6 +149,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

#define wthread_mutexattr_t pthread_mutexattr_t

#define wthread_mutexattr_init pthread_mutexattr_init

+#define wthread_mutexattr_destroy pthread_mutexattr_destroy
This will be a no-op as well.

Regards,
-Mike


#define wthread_mutexattr_settype pthread_mutexattr_settype

#define wGetCurrentThreadId pthread_self


______________________________________________________________________
______________________________________________________________________
__________________________________________________________________
Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
Openmama-dev mailing list
Openmama-dev@lists.openmama.org
http://lists.openmama.org/listinfo/openmama-dev