You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by vi...@apache.org on 2008/05/13 23:02:46 UTC

svn commit: r656010 - in /stdcxx/branches/4.2.x/tests: include/rw_thread.h src/thread.cpp

Author: vitek
Date: Tue May 13 14:02:46 2008
New Revision: 656010

URL: http://svn.apache.org/viewvc?rev=656010&view=rev
Log:
2008-05-13  Travis Vitek  <vi...@roguewave.com>

	* tests/include/rw_thread.h: Add typedef for thread function type
	with appropriate linkage and use it. Remove unnecessary C linkage
	from test library functions.
	* tests/src/thread.cpp: Use thread function typedef. Use C linkage
	where necessary.

Modified:
    stdcxx/branches/4.2.x/tests/include/rw_thread.h
    stdcxx/branches/4.2.x/tests/src/thread.cpp

Modified: stdcxx/branches/4.2.x/tests/include/rw_thread.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/include/rw_thread.h?rev=656010&r1=656009&r2=656010&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/include/rw_thread.h (original)
+++ stdcxx/branches/4.2.x/tests/include/rw_thread.h Tue May 13 14:02:46 2008
@@ -33,6 +33,8 @@
 
 
 extern "C" {
+    typedef void* rw_thread_proc (void*);
+}    // extern "C"
 
 struct rw_thread_attr_t;
 
@@ -48,7 +50,7 @@
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t*,
                   rw_thread_attr_t*,
-                  void* (*)(void*),
+                  rw_thread_proc*,
                   void*);
 
 
@@ -77,7 +79,7 @@
 rw_thread_pool (rw_thread_t*      /* tidarray */,
                 _RWSTD_SIZE_T     /* nthreads */,
                 rw_thread_attr_t* /* attr */,
-                void* (*)(void*)  /* thr_proc */,
+                rw_thread_proc*   /* thr_proc */,
                 void**            /* argarray */,
                 _RWSTD_SIZE_T     /* timeout  */ = 0);
 
@@ -93,8 +95,4 @@
 _TEST_EXPORT int
 rw_get_cpus ();
 
-
-
-}   // extern "C"
-
 #endif   // RW_RWTHREAD_H_INCLUDED

Modified: stdcxx/branches/4.2.x/tests/src/thread.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/src/thread.cpp?rev=656010&r1=656009&r2=656010&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/src/thread.cpp (original)
+++ stdcxx/branches/4.2.x/tests/src/thread.cpp Tue May 13 14:02:46 2008
@@ -68,24 +68,26 @@
 
 /************************************************************************/
 
+extern "C" {
+
 static void
 _rw_timeout_handler (int)
 {
     _rw_timeout_expired = 1;
 }
 
+}    // extern "C"
+
 /************************************************************************/
 
 
 #if defined (_RWSTD_POSIX_THREADS)
 #  include <pthread.h>
 
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
 #ifdef _RWSTD_OS_SUNOS
@@ -133,19 +135,15 @@
     return result;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #elif defined (_RWSTD_SOLARIS_THREADS)
 #  include <thread.h>
 
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
     static int concurrency_set;
@@ -194,8 +192,6 @@
     return result;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #elif defined (_RWSTD_DEC_THREADS)
@@ -203,13 +199,10 @@
 #  include <setjmp.h>
 #  include <cma.h>
 
-
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
     rw_thread_t tmpid;
@@ -268,19 +261,15 @@
     return status;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #elif defined (_WIN32) && defined (_MT)
 #  include <process.h>    // for _beginthreadex()
 
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t *thr_id,
                   rw_thread_attr_t*,
-                  void* (*thr_proc)(void*),
+                  rw_thread_proc *thr_proc,
                   void *thr_arg)
 {
     int result = 0;
@@ -348,8 +337,6 @@
     return result;
 }
 
-}   // extern "C"
-
 /**************************************************************************/
 
 #else   // unknown/missing threads environment
@@ -376,12 +363,10 @@
 #    endif
 #  endif   // ENOTSUP
 
-extern "C" {
-
 _TEST_EXPORT int
 rw_thread_create (rw_thread_t*,
                   rw_thread_attr_t*,
-                  void* (*)(void*),
+                  rw_thread_proc*,
                   void*)
 {
     _RWSTD_UNUSED (maxthreads);
@@ -396,8 +381,6 @@
     return ENOTSUP;
 }
 
-}   // extern "C"
-
 #endif   // threads environment
 
 /**************************************************************************/
@@ -495,14 +478,11 @@
 
 /**************************************************************************/
 
-extern "C" {
-
-
 _TEST_EXPORT int
 rw_thread_pool (rw_thread_t        *thr_id,
                 size_t              nthrs,
                 rw_thread_attr_t*,
-                void*             (*thr_proc)(void*),
+                rw_thread_proc     *thr_proc,
                 void*              *thr_arg,
                 size_t              timeout)
 {
@@ -606,5 +586,3 @@
 
     return 0;
 }
-
-}   // extern "C"