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

Mike Schonberg <mschonberg@...>


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@...>

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;


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.


#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


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.

Join to automatically receive all group messages.