Revision: 71635
          http://sourceforge.net/p/brlcad/code/71635
Author:   starseeker
Date:     2018-08-30 22:15:14 +0000 (Thu, 30 Aug 2018)
Log Message:
-----------
Add some headers - based on libbu/thread.cpp will probably need more here for 
the thread_local bit...

Modified Paths:
--------------
    brlcad/trunk/src/libnmg/alloc.cpp

Modified: brlcad/trunk/src/libnmg/alloc.cpp
===================================================================
--- brlcad/trunk/src/libnmg/alloc.cpp   2018-08-30 20:53:21 UTC (rev 71634)
+++ brlcad/trunk/src/libnmg/alloc.cpp   2018-08-30 22:15:14 UTC (rev 71635)
@@ -1,10 +1,30 @@
+#include "common.h"
 
+#ifdef HAVE_PTHREAD_H
+#  include <pthread.h>
+#endif
+
+#include <cassert>
+
+#include "bu/malloc.h"
+#include "bu/parallel.h"
+
+#if defined(HAVE_THREAD_LOCAL)
 static thread_local struct bu_pool *data = {NULL};
 
+#elif defined(HAVE___THREAD)
 
-/* #define NMG_GETSTRUCT(p, str) p = nmg_alloc(sizeof(p)); */
+static __thread struct bu_pool *data = {NULL};
 
-void *
+#elif defined(HAVE___DECLSPEC_THREAD)
+
+static __declspec(thread) struct bu_pool *data = {NULL};
+
+#endif
+
+/* #define NMG_GETSTRUCT(p, _type) p = (struct _type *)nmg_alloc(sizeof(struct 
_type)) */
+
+extern "C" void *
 nmg_alloc(size_t size)
 {
   assert(size < 2048);
@@ -19,7 +39,7 @@
   /* nada */
 }
 
-void
+extern "C" void
 nmg_destroy()
 {
   bu_pool_delete(data);

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to