Author: mysqlpp
Date: Sat Aug 16 13:38:05 2008
New Revision: 2340

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2340&view=rev
Log:
Swapped several of the ifdefs in beemutex.cpp, placing the check for
pthreads before synch.h in all cases, for systems like Solaris that have
both.  Earlier change on this line did this, but only in once place.
This finishes that fix.

Modified:
    trunk/lib/beemutex.cpp

Modified: trunk/lib/beemutex.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/beemutex.cpp?rev=2340&r1=2339&r2=2340&view=diff
==============================================================================
--- trunk/lib/beemutex.cpp (original)
+++ trunk/lib/beemutex.cpp Sat Aug 16 13:38:05 2008
@@ -75,11 +75,11 @@
 #      if HAVE_SYNCH_H || HAVE_PTHREAD
        register int rc;
 #      endif
-#      if HAVE_SYNCH_H
+#      if HAVE_PTHREAD
+               if ((rc = pthread_mutex_init(impl_ptr(pmutex_), 0)))
+                       throw MutexFailed(strerror(rc));
+#      elif HAVE_SYNCH_H
                if ((rc = mutex_init(impl_ptr(pmutex_), USYNC_THREAD, 0)))
-                       throw MutexFailed(strerror(rc));
-#      elif HAVE_PTHREAD
-               if ((rc = pthread_mutex_init(impl_ptr(pmutex_), 0)))
                        throw MutexFailed(strerror(rc));
 #      endif
 #endif
@@ -91,10 +91,10 @@
 #if defined(ACTUALLY_DOES_SOMETHING)
 #      if defined(MYSQLPP_PLATFORM_WINDOWS)
                CloseHandle(impl_val(pmutex_));
+#      elif HAVE_PTHREAD
+               pthread_mutex_destroy(impl_ptr(pmutex_));
 #      elif HAVE_SYNCH_H
                mutex_destroy(impl_ptr(pmutex_));
-#      elif HAVE_PTHREAD
-               pthread_mutex_destroy(impl_ptr(pmutex_));
 #      endif
 
        delete impl_ptr(pmutex_);
@@ -113,11 +113,11 @@
 #      if HAVE_SYNCH_H || HAVE_PTHREAD
        register int rc;
 #      endif
-#      if HAVE_SYNCH_H
+#      if HAVE_PTHREAD
+               if ((rc = pthread_mutex_lock(impl_ptr(pmutex_))))
+                       throw MutexFailed(strerror(rc));
+#      elif HAVE_SYNCH_H
                if ((rc = mutex_lock(impl_ptr(pmutex_))))
-                       throw MutexFailed(strerror(rc));
-#      elif HAVE_PTHREAD
-               if ((rc = pthread_mutex_lock(impl_ptr(pmutex_))))
                        throw MutexFailed(strerror(rc));
 #      endif
 #endif
@@ -139,14 +139,14 @@
                }
 #      else
                register int rc;
-#              if HAVE_SYNCH_H
-                       if ((rc = mutex_trylock(impl_ptr(pmutex_))) == 0)
+#              if HAVE_PTHREAD
+                       if ((rc = pthread_mutex_trylock(impl_ptr(pmutex_))) == 
0)
                                return true;
                        if (rc == EBUSY)
                                return false;
                        throw MutexFailed(strerror(rc));
-#              elif HAVE_PTHREAD
-                       if ((rc = pthread_mutex_trylock(impl_ptr(pmutex_))) == 
0)
+#              elif HAVE_SYNCH_H
+                       if ((rc = mutex_trylock(impl_ptr(pmutex_))) == 0)
                                return true;
                        if (rc == EBUSY)
                                return false;
@@ -169,11 +169,11 @@
 #      if HAVE_SYNCH_H || HAVE_PTHREAD
                register int rc;
 #      endif
-#      if HAVE_SYNCH_H
+#      if HAVE_PTHREAD
+               if ((rc = pthread_mutex_unlock(impl_ptr(pmutex_))))
+                       throw MutexFailed(strerror(rc));
+#      elif HAVE_SYNCH_H
                if ((rc = mutex_unlock(impl_ptr(pmutex_))))
-                       throw MutexFailed(strerror(rc));
-#      elif HAVE_PTHREAD
-               if ((rc = pthread_mutex_unlock(impl_ptr(pmutex_))))
                        throw MutexFailed(strerror(rc));
 #      endif
 #endif


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to