|
|
@ -527,7 +527,7 @@ inline uint32_t ByteReverse(uint32_t value) |
|
|
|
// Standard wrapper for do-something-forever thread functions.
|
|
|
|
// Standard wrapper for do-something-forever thread functions.
|
|
|
|
// "Forever" really means until the thread is interrupted.
|
|
|
|
// "Forever" really means until the thread is interrupted.
|
|
|
|
// Use it like:
|
|
|
|
// Use it like:
|
|
|
|
// new boost::thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, 10000));
|
|
|
|
// new boost::thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, 900000));
|
|
|
|
// or maybe:
|
|
|
|
// or maybe:
|
|
|
|
// boost::function<void()> f = boost::bind(&FunctionWithArg, argument);
|
|
|
|
// boost::function<void()> f = boost::bind(&FunctionWithArg, argument);
|
|
|
|
// threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "nothing", f, milliseconds));
|
|
|
|
// threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "nothing", f, milliseconds));
|
|
|
@ -540,8 +540,8 @@ template <typename Callable> void LoopForever(const char* name, Callable func, |
|
|
|
{ |
|
|
|
{ |
|
|
|
while (1) |
|
|
|
while (1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
func(); |
|
|
|
|
|
|
|
MilliSleep(msecs); |
|
|
|
MilliSleep(msecs); |
|
|
|
|
|
|
|
func(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (boost::thread_interrupted) |
|
|
|
catch (boost::thread_interrupted) |
|
|
|