mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[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:
parent
f117ce3420
commit
2aff48cc5d
182 changed files with 684 additions and 21041 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue