Commits

ecsv  committed edabfd8

Replace Boost::Thread dependency with standard C++ functionality

  • Participants
  • Parent commits 359fbb1

Comments (0)

Files changed (3)

File projects/unix/Makefile

   SHARED = -shared
   PIC = 0
   BOOST_SUFFIX = -mt
-  BOOST_THREAD_SUFFIX = _win32-mt
 endif
 ifeq ("$(OS)","NONE")
   $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 CXXFLAGS += -fvisibility-inlines-hidden -std=gnu++11
 LDFLAGS += $(SHARED)
 BOOST_SUFFIX ?=
-BOOST_THREAD_SUFFIX ?=
 
 ifeq ($(CPU), X86)
   CFLAGS +=  -mmmx -msse
 	$(SRCDIR)/GlideHQ/tc-1.1+/texstore.c
 
 CFLAGS += -DTEXTURE_FILTER
-LDLIBS += -lboost_filesystem$(BOOST_SUFFIX) -lboost_system$(BOOST_SUFFIX) -lboost_thread$(BOOST_THREAD_SUFFIX)
-
-  ifeq ($(OS), MINGW)
-    CFLAGS += -DBOOST_THREAD_USE_LIB
-    LDLIBS += -lpthread
-  else
-    CFLAGS += -pthread
-    LDLIBS += -pthread
-  endif
+LDLIBS += -lboost_filesystem$(BOOST_SUFFIX) -lboost_system$(BOOST_SUFFIX)
 endif
 
 ifeq ($(OS),MINGW)

File src/GlideHQ/TxFilter.cpp

 #include "TxFilter.h"
 #include "TextureFilters.h"
 #include "TxDbg.h"
-#include <boost/thread.hpp>
-#include <boost/bind.hpp>
+#include <functional>
+#include <thread>
 
 void TxFilter::clear()
 {
           numcore--;
         }
         if (blkrow > 0 && numcore > 1) {
-          boost::thread *thrd[MAX_NUMCORE];
+          std::thread *thrd[MAX_NUMCORE];
           unsigned int i;
           int blkheight = blkrow << 2;
           unsigned int srcStride = (srcwidth * blkheight) << 2;
           unsigned int destStride = srcStride << scale_shift << scale_shift;
           for (i = 0; i < numcore - 1; i++) {
-            thrd[i] = new boost::thread(boost::bind(filter_8888,
-                                                    (uint32*)_texture,
-                                                    srcwidth,
-                                                    blkheight,
-                                                    (uint32*)_tmptex,
-                                                    filter));
+            thrd[i] = new std::thread(std::bind(filter_8888,
+                                                (uint32*)_texture,
+                                                srcwidth,
+                                                blkheight,
+                                                (uint32*)_tmptex,
+                                                filter));
             _texture += srcStride;
             _tmptex  += destStride;
           }
-          thrd[i] = new boost::thread(boost::bind(filter_8888,
-                                                  (uint32*)_texture,
-                                                  srcwidth,
-                                                  srcheight - blkheight * i,
-                                                  (uint32*)_tmptex,
-                                                  filter));
+          thrd[i] = new std::thread(std::bind(filter_8888,
+                                              (uint32*)_texture,
+                                              srcwidth,
+                                              srcheight - blkheight * i,
+                                              (uint32*)_tmptex,
+                                              filter));
           for (i = 0; i < numcore; i++) {
             thrd[i]->join();
             delete thrd[i];

File src/GlideHQ/TxQuantize.cpp

 #pragma warning(disable: 4786)
 #endif
 
+#include <functional>
+#include <thread>
+
 /* NOTE: The codes are not optimized. They can be made faster. */
 
 #include "TxQuantize.h"
-#include <boost/thread.hpp>
-#include <boost/bind.hpp>
 
 TxQuantize::TxQuantize()
 {
       numcore--;
     }
     if (blkrow > 0 && numcore > 1) {
-      boost::thread *thrd[MAX_NUMCORE];
+      std::thread *thrd[MAX_NUMCORE];
       unsigned int i;
       int blkheight = blkrow << 2;
       unsigned int srcStride = (width * blkheight) << (2 - bpp_shift);
       unsigned int destStride = srcStride << bpp_shift;
       for (i = 0; i < numcore - 1; i++) {
-        thrd[i] = new boost::thread(boost::bind(quantizer,
-                                                this,
-                                                (uint32*)src,
-                                                (uint32*)dest,
-                                                width,
-                                                blkheight));
+        thrd[i] = new std::thread(std::bind(quantizer,
+                                            this,
+                                            (uint32*)src,
+                                            (uint32*)dest,
+                                            width,
+                                            blkheight));
         src  += srcStride;
         dest += destStride;
       }
-      thrd[i] = new boost::thread(boost::bind(quantizer,
-                                              this,
-                                              (uint32*)src,
-                                              (uint32*)dest,
-                                              width,
-                                              height - blkheight * i));
+      thrd[i] = new std::thread(std::bind(quantizer,
+                                          this,
+                                          (uint32*)src,
+                                          (uint32*)dest,
+                                          width,
+                                          height - blkheight * i));
       for (i = 0; i < numcore; i++) {
         thrd[i]->join();
         delete thrd[i];
       numcore--;
     }
     if (blkrow > 0 && numcore > 1) {
-      boost::thread *thrd[MAX_NUMCORE];
+      std::thread *thrd[MAX_NUMCORE];
       unsigned int i;
       int blkheight = blkrow << 2;
       unsigned int srcStride = (width * blkheight) << 2;
       unsigned int destStride = srcStride >> bpp_shift;
       for (i = 0; i < numcore - 1; i++) {
-        thrd[i] = new boost::thread(boost::bind(quantizer,
-                                                this,
-                                                (uint32*)src,
-                                                (uint32*)dest,
-                                                width,
-                                                blkheight));
+        thrd[i] = new std::thread(std::bind(quantizer,
+                                            this,
+                                            (uint32*)src,
+                                            (uint32*)dest,
+                                            width,
+                                            blkheight));
         src  += srcStride;
         dest += destStride;
       }
-      thrd[i] = new boost::thread(boost::bind(quantizer,
-                                              this,
-                                              (uint32*)src,
-                                              (uint32*)dest,
-                                              width,
-                                              height - blkheight * i));
+      thrd[i] = new std::thread(std::bind(quantizer,
+                                          this,
+                                          (uint32*)src,
+                                          (uint32*)dest,
+                                          width,
+                                          height - blkheight * i));
       for (i = 0; i < numcore; i++) {
         thrd[i]->join();
         delete thrd[i];
       numcore--;
     }
     if (blkrow > 0 && numcore > 1) {
-      boost::thread *thrd[MAX_NUMCORE];
+      std::thread *thrd[MAX_NUMCORE];
       unsigned int i;
       int blkheight = blkrow << 2;
       unsigned int srcStride = (srcwidth * blkheight) << 2;
       unsigned int destStride = dstRowStride * blkrow;
       for (i = 0; i < numcore - 1; i++) {
-        thrd[i] = new boost::thread(boost::bind(_tx_compress_fxt1,
-                                                srcwidth,
-                                                blkheight,
-                                                4,
-                                                src,
-                                                srcRowStride,
-                                                dest,
-                                                dstRowStride));
+        thrd[i] = new std::thread(std::bind(_tx_compress_fxt1,
+                                            srcwidth,
+                                            blkheight,
+                                            4,
+                                            src,
+                                            srcRowStride,
+                                            dest,
+                                            dstRowStride));
         src  += srcStride;
         dest += destStride;
       }
-      thrd[i] = new boost::thread(boost::bind(_tx_compress_fxt1,
-                                              srcwidth,
-                                              srcheight - blkheight * i,
-                                              4,
-                                              src,
-                                              srcRowStride,
-                                              dest,
-                                              dstRowStride));
+      thrd[i] = new std::thread(std::bind(_tx_compress_fxt1,
+                                          srcwidth,
+                                          srcheight - blkheight * i,
+                                          4,
+                                          src,
+                                          srcRowStride,
+                                          dest,
+                                          dstRowStride));
       for (i = 0; i < numcore; i++) {
         thrd[i]->join();
         delete thrd[i];
         numcore--;
       }
       if (blkrow > 0 && numcore > 1) {
-        boost::thread *thrd[MAX_NUMCORE];
+        std::thread *thrd[MAX_NUMCORE];
         unsigned int i;
         int blkheight = blkrow << 2;
         unsigned int srcStride = (srcwidth * blkheight) << 2;
         unsigned int destStride = dstRowStride * blkrow;
         for (i = 0; i < numcore - 1; i++) {
-          thrd[i] = new boost::thread(boost::bind(_tx_compress_dxtn,
-                                                  4,
-                                                  srcwidth,
-                                                  blkheight,
-                                                  src,
-                                                  compression,
-                                                  dest,
-                                                  dstRowStride));
+          thrd[i] = new std::thread(std::bind(_tx_compress_dxtn,
+                                              4,
+                                              srcwidth,
+                                              blkheight,
+                                              src,
+                                              compression,
+                                              dest,
+                                              dstRowStride));
           src  += srcStride;
           dest += destStride;
         }
-        thrd[i] = new boost::thread(boost::bind(_tx_compress_dxtn,
-                                                4,
-                                                srcwidth,
-                                                srcheight - blkheight * i,
-                                                src,
-                                                compression,
-                                                dest,
-                                                dstRowStride));
+        thrd[i] = new std::thread(std::bind(_tx_compress_dxtn,
+                                            4,
+                                            srcwidth,
+                                            srcheight - blkheight * i,
+                                            src,
+                                            compression,
+                                            dest,
+                                            dstRowStride));
         for (i = 0; i < numcore; i++) {
           thrd[i]->join();
           delete thrd[i];