logo       


r10507 - trunk/fundev/sources/lib/run-time: msg#00010

Subject: r10507 - trunk/fundev/sources/lib/run-time
Author: hannes
Date: Sat Feb  4 22:08:52 2006
New Revision: 10507

Modified:
   trunk/fundev/sources/lib/run-time/linux-support.c
   trunk/fundev/sources/lib/run-time/linux-threads-primitives.c
   trunk/fundev/sources/lib/run-time/linux-types.h
Log:
Bug: 7297
some #ifdefs for FreeBSD


Modified: trunk/fundev/sources/lib/run-time/linux-support.c
==============================================================================
--- trunk/fundev/sources/lib/run-time/linux-support.c   (original)
+++ trunk/fundev/sources/lib/run-time/linux-support.c   Sat Feb  4 22:08:52 2006
@@ -2,7 +2,11 @@
 
 #include <time.h>
 #include <stdio.h>
+#ifndef FREEBSD 
 #include <malloc.h>
+#else
+#include <stdlib.h>
+#endif
 #include <sys/time.h>
 #include <sys/resource.h>
 

Modified: trunk/fundev/sources/lib/run-time/linux-threads-primitives.c
==============================================================================
--- trunk/fundev/sources/lib/run-time/linux-threads-primitives.c        
(original)
+++ trunk/fundev/sources/lib/run-time/linux-threads-primitives.c        Sat Feb 
 4 22:08:52 2006
@@ -789,7 +789,11 @@
 
   res = pthread_mutexattr_init(&attr);
   if(res != 0) return GENERAL_ERROR;
+#ifdef PTHREAD_MUTEX_ERRORCHECK_NP
   res = pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
+#else
+  res = pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_ERRORCHECK);
+#endif
   if(res != 0) return GENERAL_ERROR;
   res = pthread_mutex_init(&rlock->mutex, &attr);
   if(res != 0) return GENERAL_ERROR;
@@ -841,7 +845,11 @@
 
   res = pthread_mutexattr_init(&attr);
   if(res != 0) return GENERAL_ERROR;
+#ifdef PTHREAD_MUTEX_ERRORCHECK_NP
   res = pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
+#else
+  res = pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_ERRORCHECK);
+#endif
   if(res != 0) return GENERAL_ERROR;
   res = pthread_mutex_init(&slock->mutex, &attr);
   if(res != 0) return GENERAL_ERROR;

Modified: trunk/fundev/sources/lib/run-time/linux-types.h
==============================================================================
--- trunk/fundev/sources/lib/run-time/linux-types.h     (original)
+++ trunk/fundev/sources/lib/run-time/linux-types.h     Sat Feb  4 22:08:52 2006
@@ -27,18 +27,36 @@
 
 /* Critical section macros */
 
+#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 #define define_CRITICAL_SECTION(lock) \
   pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#else
+#define define_CRITICAL_SECTION(lock) \
+  pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER
+#endif
+
 #define extern_CRITICAL_SECTION(lock) \
   extern pthread_mutex_t lock
+#ifdef PTHREAD_MUTEX_RECURSIVE_NP
 #define initialize_CRITICAL_SECTION(mutex) \
   do { \
     pthread_mutexattr_t _attr; \
     pthread_mutexattr_init(&_attr); \
     pthread_mutexattr_setkind_np(&_attr, PTHREAD_MUTEX_RECURSIVE_NP); \
+    pthread_mutexattr_setkind_np(&_attr, PTHREAD_MUTEX_RECURSIVE); \
     pthread_mutex_init((mutex), &_attr); \
     pthread_mutexattr_destroy(&_attr); \
   } while(0)
+#else
+#define initialize_CRITICAL_SECTION(mutex) \
+  do { \
+    pthread_mutexattr_t _attr; \
+    pthread_mutexattr_init(&_attr); \
+    pthread_mutexattr_setkind_np(&_attr, PTHREAD_MUTEX_RECURSIVE); \
+    pthread_mutex_init((mutex), &_attr); \
+    pthread_mutexattr_destroy(&_attr); \
+  } while(0)
+#endif
 
 #define enter_CRITICAL_SECTION(lock)      pthread_mutex_lock(lock)
 #define leave_CRITICAL_SECTION(lock)      pthread_mutex_unlock(lock)
-- 
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
https://www.gwydiondylan.org/mailman/listinfo/gd-chatter



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe