Permalink
Browse files

cdecl missing in functions which are passed to pthread_cleanup_push()…

…: fixed -- matches type ptw32_cleanup_callback_t this way.
  • Loading branch information...
1 parent ad791b6 commit ae46f236d4c411485d4a3c2a0eecee88bbf55559 @GerHobbelt committed Jul 20, 2011
Showing with 62 additions and 64 deletions.
  1. +11 −9 implement.h
  2. +6 −6 pthread_mutex_unlock.c
  3. +26 −26 ptw32_MCS_lock.c
  4. +6 −6 ptw32_rwlock_cancelwrwait.c
  5. +1 −1 tests/cleanup0.c
  6. +1 −5 tests/cleanup1.c
  7. +1 −1 tests/cleanup2.c
  8. +1 −1 tests/cleanup3.c
  9. +9 −9 tests/mutex7.c
View
@@ -10,25 +10,25 @@
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
+ *
* Contact Email: Ross.Johnson@homemail.com.au
- *
+ *
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
@@ -178,7 +178,7 @@ struct ptw32_thread_t_
};
-/*
+/*
* Special value to mark attribute objects as valid.
*/
#define PTW32_ATTR_VALID ((unsigned long) 0xC4C0FFEE)
@@ -469,7 +469,7 @@ struct ThreadKeyAssoc
* The pthread_key_t->threads attribute is the head of
* a chain of associations that runs through the
* nextThreads link. This chain provides the 1 to many
- * relationship between a pthread_key_t and all the
+ * relationship between a pthread_key_t and all the
* PThreads that have called pthread_setspecific for
* this pthread_key_t.
*
@@ -630,11 +630,13 @@ extern "C"
void ptw32_threadReusePush (pthread_t thread);
+ PTW32_DLLPORT void PTW32_CDECL ptw32_threadCleanReuseCache(void);
+
int ptw32_getprocessors (int *count);
int ptw32_setthreadpriority (pthread_t thread, int policy, int priority);
- void ptw32_rwlock_cancelwrwait (void *arg);
+ void PTW32_CDECL ptw32_rwlock_cancelwrwait (void *arg); /* matches type ptw32_cleanup_callback_t this way */
#if ! (defined (__MINGW64__) || defined(__MINGW32__)) || (defined(__MSVCRT__) && ! defined(__DMC__))
unsigned __stdcall
@@ -917,7 +919,7 @@ extern "C"
#if defined(NEED_CREATETHREAD)
-/*
+/*
* Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE
* in order to avoid warnings because of return type
*/
View
@@ -9,25 +9,25 @@
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
+ *
* Contact Email: rpj@callisto.canberra.edu.au
- *
+ *
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
@@ -38,7 +38,7 @@
#include "implement.h"
-int
+int PTW32_CDECL
pthread_mutex_unlock (pthread_mutex_t * mutex)
{
int result = 0;
View
@@ -9,25 +9,25 @@
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
+ *
* Contact Email: rpj@callisto.canberra.edu.au
- *
+ *
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
@@ -40,7 +40,7 @@
* MCS locks are queue-based locks, where the queue nodes are local to the
* thread. The 'lock' is nothing more than a global pointer that points to
* the last node in the queue, or is NULL if the queue is empty.
- *
+ *
* Originally designed for use as spin locks requiring no kernel resources
* for synchronisation or blocking, the implementation below has adapted
* the MCS spin lock for use as a general mutex that will suspend threads
@@ -63,7 +63,7 @@
* every lock held concurrently by a thread.
*
* E.g.:
- *
+ *
* ptw32_mcs_lock_t lock1 = 0;
* ptw32_mcs_lock_t lock2 = 0;
*
@@ -95,11 +95,11 @@
/*
* ptw32_mcs_flag_set -- notify another thread about an event.
- *
+ *
* Set event if an event handle has been stored in the flag, and
* set flag to -1 otherwise. Note that -1 cannot be a valid handle value.
*/
-INLINE void
+INLINE void
ptw32_mcs_flag_set (HANDLE * flag)
{
HANDLE e = (HANDLE)(PTW32_INTERLOCKED_SIZE)PTW32_INTERLOCKED_COMPARE_EXCHANGE_SIZE(
@@ -115,11 +115,11 @@ ptw32_mcs_flag_set (HANDLE * flag)
/*
* ptw32_mcs_flag_set -- wait for notification from another.
- *
+ *
* Store an event handle in the flag and wait on it if the flag has not been
* set, and proceed without creating an event otherwise.
*/
-INLINE void
+INLINE void
ptw32_mcs_flag_wait (HANDLE * flag)
{
if ((PTW32_INTERLOCKED_LONG)0 ==
@@ -145,25 +145,25 @@ ptw32_mcs_flag_wait (HANDLE * flag)
/*
* ptw32_mcs_lock_acquire -- acquire an MCS lock.
- *
- * See:
+ *
+ * See:
* J. M. Mellor-Crummey and M. L. Scott.
* Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors.
* ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991.
*/
#if defined(PTW32_BUILD_INLINED)
-INLINE
+INLINE
#endif /* PTW32_BUILD_INLINED */
-void
+void
ptw32_mcs_lock_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node)
{
ptw32_mcs_local_node_t *pred;
-
+
node->lock = lock;
node->nextFlag = 0;
node->readyFlag = 0;
node->next = 0; /* initially, no successor */
-
+
/* queue for the lock */
pred = (ptw32_mcs_local_node_t *)PTW32_INTERLOCKED_EXCHANGE_PTR((PTW32_INTERLOCKED_PVOID_PTR)lock,
(PTW32_INTERLOCKED_PVOID)node);
@@ -179,16 +179,16 @@ ptw32_mcs_lock_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node)
/*
* ptw32_mcs_lock_release -- release an MCS lock.
- *
- * See:
+ *
+ * See:
* J. M. Mellor-Crummey and M. L. Scott.
* Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors.
* ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991.
*/
#if defined(PTW32_BUILD_INLINED)
-INLINE
+INLINE
#endif /* PTW32_BUILD_INLINED */
-void
+void PTW32_CDECL
ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node)
{
ptw32_mcs_lock_t *lock = node->lock;
@@ -208,7 +208,7 @@ ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node)
/* no successor, lock is free now */
return;
}
-
+
/* wait for successor */
ptw32_mcs_flag_wait(&node->nextFlag);
next = (ptw32_mcs_local_node_t *)
@@ -223,9 +223,9 @@ ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node)
* ptw32_mcs_lock_try_acquire
*/
#if defined(PTW32_BUILD_INLINED)
-INLINE
+INLINE
#endif /* PTW32_BUILD_INLINED */
-int
+int
ptw32_mcs_lock_try_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node)
{
node->lock = lock;
@@ -251,9 +251,9 @@ ptw32_mcs_lock_try_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * no
* Should only be called by the thread that has the lock.
*/
#if defined(PTW32_BUILD_INLINED)
-INLINE
+INLINE
#endif /* PTW32_BUILD_INLINED */
-void
+void
ptw32_mcs_node_transfer (ptw32_mcs_local_node_t * new_node, ptw32_mcs_local_node_t * old_node)
{
new_node->lock = old_node->lock;
@@ -9,25 +9,25 @@
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
- *
+ *
* Contact Email: rpj@callisto.canberra.edu.au
- *
+ *
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
@@ -37,7 +37,7 @@
#include "pthread.h"
#include "implement.h"
-void
+void PTW32_CDECL
ptw32_rwlock_cancelwrwait (void *arg)
{
pthread_rwlock_t rwl = (pthread_rwlock_t) arg;
View
@@ -99,7 +99,7 @@ typedef struct {
static sharedInt_t pop_count = {0, {0}};
-static void
+static void PTW32_CDECL
increment_pop_count(void * arg)
{
sharedInt_t * sI = (sharedInt_t *) arg;
View
@@ -99,11 +99,7 @@ typedef struct {
static sharedInt_t pop_count = {0, {0}};
-static void
-#ifdef __CLEANUP_C
-__cdecl
-#endif
-increment_pop_count(void * arg)
+static void PTW32_CDECL increment_pop_count(void * arg) /* [i_a] matches type ptw32_cleanup_callback_t this way */
{
sharedInt_t * sI = (sharedInt_t *) arg;
View
@@ -99,7 +99,7 @@ typedef struct {
static sharedInt_t pop_count = {0, {0}};
-static void
+static void PTW32_CDECL
increment_pop_count(void * arg)
{
sharedInt_t * sI = (sharedInt_t *) arg;
View
@@ -100,7 +100,7 @@ typedef struct {
static sharedInt_t pop_count = {0, {0}};
-static void
+static void PTW32_CDECL
increment_pop_count(void * arg)
{
sharedInt_t * sI = (sharedInt_t *) arg;
Oops, something went wrong.

0 comments on commit ae46f23

Please sign in to comment.