What does thread safe mean in a PHP context?
Possible Duplicate:
What is thread safe or non thread safe in PHP
当某些东西是线程安全的还是非线程安全的时候,这意味着什么?
例如,php中的setlocale()不是线程安全的:
The locale information is maintained per process, not per thread. If
you are running PHP on a multithreaded server API like IIS or Apache
on Windows, you may experience sudden changes in locale settings while
a script is running, though the script itself never called
setlocale(). This happens due to other scripts running in different
threads of the same process at the same time, changing the
process-wide locale using setlocale().
http://php.net/manual/en/function.setlocale.php
这实际上意味着什么?有没有什么东西是线程安全的?
在什么情况下,您需要线程安全或非线程安全的解决方案来解决您的问题?
线程安全是一件好事,这意味着虽然可能有多个并发线程,但它们以一种安全的方式相互交谈,不会有争用条件、并发问题等。
Thread safety is a computer programming concept applicable in the
context of multi-threaded programs. A piece of code is thread-safe if
it only manipulates shared data structures in a thread-safe manner,
which enables safe execution by multiple threads at the same time.
There are various strategies for making thread-safe data structures.
来源。