Moved the definition of _AIX_AtomicSet() to the outside of the
authorwtc
Tue, 02 Jun 1998 03:25:22 +0000
changeset 138 dc980a7b3eb0500171461e14c5e79036642ec12e
parent 134 7b148626c4a9afcfad6b613b2cff127c9ab31715
child 140 896094396c6f5fcba58b52dab83eea743de7537c
push idunknown
push userunknown
push dateunknown
Moved the definition of _AIX_AtomicSet() to the outside of the #ifndef AIX4_1 block. Thanks to C. Fung <carsonf@torolab.ibm.com> for reporting this problem.
pr/src/md/unix/aix.c
--- a/pr/src/md/unix/aix.c
+++ b/pr/src/md/unix/aix.c
@@ -21,37 +21,24 @@
 /*
  * NSPR 2.0 overrides the system select() and poll() functions.
  * On AIX 4.2, we use dlopen("/unix", RTLD_NOW) and dlsym() to get
  * at the original system select() and poll() functions.
  */
 
 #ifndef AIX4_1
 
-#include <sys/atomic_op.h>
 #include <sys/select.h>
 #include <sys/poll.h>
 #include <dlfcn.h>
 
 static void *aix_handle = NULL;
 static int (*aix_select_fcn)() = NULL;
 static int (*aix_poll_fcn)() = NULL;
 
-PRInt32 _AIX_AtomicSet(PRInt32 *val, PRInt32 newval)
-{
-    PRIntn oldval;
-    boolean_t stored;
-    oldval = fetch_and_add((atomic_p)val, 0);
-    do
-    {
-        stored = compare_and_swap((atomic_p)val, &oldval, newval);
-    } while (!stored);
-    return oldval;
-}  /* _AIX_AtomicSet */
-
 int _MD_SELECT(int width, fd_set *r, fd_set *w, fd_set *e, struct timeval *t)
 {
     int rv;
 
     if (!aix_select_fcn) {
 	if (!aix_handle) {
 	    aix_handle = dlopen("/unix", RTLD_NOW);
 	    if (!aix_handle) {
@@ -101,16 +88,30 @@ int _MD_POLL(void *listptr, unsigned lon
 #include <sys/poll.h>
 void _pr_aix_dummy()
 {
     poll(0,0,0);
 }
 
 #endif /* !AIX4_1 */
 
+#include <sys/atomic_op.h>
+
+PRInt32 _AIX_AtomicSet(PRInt32 *val, PRInt32 newval)
+{
+    PRIntn oldval;
+    boolean_t stored;
+    oldval = fetch_and_add((atomic_p)val, 0);
+    do
+    {
+        stored = compare_and_swap((atomic_p)val, &oldval, newval);
+    } while (!stored);
+    return oldval;
+}  /* _AIX_AtomicSet */
+
 #if !defined(PTHREADS_USER)
 
 #ifdef _PR_PTHREADS
 
 /*
  * AIX 4.3 has sched_yield().  AIX 4.2 has pthread_yield().
  * So we look up the appropriate function pointer at run time.
  */