[7810] Moved ZThread related code on ACE framework.

Remove ZThread source code from mangos.
Signed-off-by: AlexDereka <dereka.alex@gmail.com>
This commit is contained in:
Ambal 2009-05-11 12:13:41 +04:00 committed by AlexDereka
parent f117ce3420
commit 2aff48cc5d
182 changed files with 684 additions and 21041 deletions

View file

@ -21,40 +21,34 @@
#include "sockets/socket_include.h"
#include "utf8cpp/utf8.h"
#include "mersennetwister/MersenneTwister.h"
#include "zthread/ThreadLocal.h"
#include <ace/TSS_T.h>
typedef ZThread::ThreadLocal<MTRand> MTRandTSS;
/* NOTE: Not sure if static initialization is ok for TSS objects ,
* as I see zthread uses custom implementation of the TSS
* ,and in the consturctor there is no code ,so I suppose its ok
* If its not ok ,change it to use singleton.
*/
typedef ACE_TSS<MTRand> MTRandTSS;
static MTRandTSS mtRand;
int32 irand (int32 min, int32 max)
{
return int32 (mtRand.get ().randInt (max - min)) + min;
return int32 (mtRand->randInt (max - min)) + min;
}
uint32 urand (uint32 min, uint32 max)
{
return mtRand.get ().randInt (max - min) + min;
return mtRand->randInt (max - min) + min;
}
int32 rand32 ()
{
return mtRand.get ().randInt ();
return mtRand->randInt ();
}
double rand_norm(void)
{
return mtRand.get ().randExc ();
return mtRand->randExc ();
}
double rand_chance (void)
{
return mtRand.get ().randExc (100.0);
return mtRand->randExc (100.0);
}
Tokens StrSplit(const std::string &src, const std::string &sep)