Revision: 54432
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54432&view=rev
Author:   d_rossberg
Date:     2013-02-19 15:51:30 +0000 (Tue, 19 Feb 2013)
Log Message:
-----------
experimental feature: activate semaphores
this change has no impact on existing code

Modified Paths:
--------------
    rt^3/trunk/include/brlcad/globals.h
    rt^3/trunk/src/coreInterface/globals.cpp

Modified: rt^3/trunk/include/brlcad/globals.h
===================================================================
--- rt^3/trunk/include/brlcad/globals.h 2013-02-16 04:00:25 UTC (rev 54431)
+++ rt^3/trunk/include/brlcad/globals.h 2013-02-19 15:51:30 UTC (rev 54432)
@@ -61,6 +61,12 @@
     void BRLCAD_COREINTERFACE_EXPORT RegisterLogHandler(LogHandler& 
logHandler) throw(bad_alloc);
     void BRLCAD_COREINTERFACE_EXPORT DeRegisterLogHandler(LogHandler& 
logHandler) throw();
     //@}
+
+    /// @name special BRL-CAD library setups
+    //@{
+    /// activate thread-protection - this makes the functions threadsafe but 
slower
+    void BRLCAD_COREINTERFACE_EXPORT PrepareForMultithreading(void) 
throw(bad_alloc);
+    //@}
 }
 
 

Modified: rt^3/trunk/src/coreInterface/globals.cpp
===================================================================
--- rt^3/trunk/src/coreInterface/globals.cpp    2013-02-16 04:00:25 UTC (rev 
54431)
+++ rt^3/trunk/src/coreInterface/globals.cpp    2013-02-19 15:51:30 UTC (rev 
54432)
@@ -29,6 +29,7 @@
  */
 
 #include "bu.h"
+#include "raytrace.h"
 
 #include <brlcad/brlcadversion.h>
 #include <brlcad/globals.h>
@@ -92,3 +93,15 @@
 
     BU_UNSETJUMP;
 }
+
+
+void BRLCAD_COREINTERFACE_EXPORT BRLCAD::PrepareForMultithreading(void) 
throw(bad_alloc) {
+    if (!BU_SETJUMP)
+        bu_semaphore_init(RT_SEM_LAST);
+    else {
+        BU_UNSETJUMP;
+        throw bad_alloc("BRLCAD::PrepareForMultithreading");
+    }
+
+    BU_UNSETJUMP;
+}

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to