[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Upvalues vs C static variable
- From: 云风 <cloudwu@...>
- Date: Sat, 14 Apr 2018 00:08:08 +0800
> 在 2018年4月13日,下午11:35,Albert Chan <albertmcchan@yahoo.com> 写道:
>
>
> Prior to lua 5.4, lua math.random() use C rand().
> rand() does not know about lua upvalues.
>
>
CRT is thread-safe, but using a C static variable isn’t.
When we run multi-states in multi-thread, calling math.rand() at the same time, the random sequence may rewind .