]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/mtasker.hh
builder: avoid config change prompts on each pdns-recursor update
[thirdparty/pdns.git] / pdns / mtasker.hh
index 313d18f290930e963475bd8090d4ba2152f39b4f..bff0eca0ff1c5f77e88b1e4a2a8f1a0cf1214c67 100644 (file)
@@ -19,8 +19,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-#ifndef MTASKER_HH
-#define MTASKER_HH
+#pragma once
 #include <stdint.h>
 #include <queue>
 #include <vector>
@@ -68,9 +67,10 @@ private:
 
   typedef std::map<int, ThreadInfo> mthreads_t;
   mthreads_t d_threads;
+  size_t d_stacksize;
+  size_t d_threadsCount;
   int d_tid;
   int d_maxtid;
-  size_t d_stacksize;
 
   EventVal d_waitval;
   enum waitstatusenum {Error=-1,TimeOut=0,Answer} d_waitstatus;
@@ -110,9 +110,12 @@ public:
       This limit applies solely to the stack, the heap is not limited in any way. If threads need to allocate a lot of data,
       the use of new/delete is suggested. 
    */
-  MTasker(size_t stacksize=16*8192) : d_tid(0), d_maxtid(0), d_stacksize(stacksize), d_waitstatus(Error)
+  MTasker(size_t stacksize=16*8192) : d_stacksize(stacksize), d_threadsCount(0), d_tid(0), d_maxtid(0), d_waitstatus(Error)
   {
     initMainStackBounds();
+
+    // make sure our stack is 16-byte aligned to make all the architectures happy
+    d_stacksize = d_stacksize >> 4 << 4;
   }
 
   typedef void tfunc_t(void *); //!< type of the pointer that starts a thread 
@@ -132,6 +135,3 @@ private:
   EventKey d_eventkey;   // for waitEvent, contains exact key it was awoken for
 };
 #include "mtasker.cc"
-
-#endif // MTASKER_HH
-