Changes between Version 26 and Version 27 of AppMultiThread


Ignore:
Timestamp:
Dec 18, 2009, 8:53:42 AM (14 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppMultiThread

    v26 v27  
    1717
    1818You should set the priority of new threads to that of the main thread.
     19{{{
     20#ifdef MSVC
     21#define getThreadPriority() GetThreadPriority(GetCurrentThread())
     22#define setThreadPriority(num) SetThreadPriority(GetCurrentThread(),
     23num)
     24#else
     25#include <sys/resource.h>
     26#define getThreadPriority() getpriority(PRIO_PROCESS, 0)
     27#define setThreadPriority(num) nice(num)
     28#endif
     29}}}
     30getThreadPriority() is called before forking (by OpenMP in AQUA's case),
     31and setThreadPriority() is then called by each worker thread.
    1932
    2033== Deploying a multi-threaded app version ==