Home  >  Article  >  Backend Development  >  php pthreads CLI has stop when using mutex

php pthreads CLI has stop when using mutex

WBOY
WBOYOriginal
2016-12-01 00:56:241447browse

When PTHREADS uses mutex to lock, the cli crashes (WIN7)

Code:

<code><?php
$mutex = Mutex::create();
var_dump(Mutex::lock($mutex));
?></code>

If you can tell me where the php system log is (similar to APACHE's error.log).

Just to add:

According to the official PTHREADS, it is thread-safe. In theory, thread-safety itself means protecting resources shared between multiple threads. So what is the significance of this lock? I also tried multi-threaded operation of Threaded shared resources, and found that there was no problem with the final output. I don’t understand it very well. Please give me some advice

Reply content:

When PTHREADS uses mutex to lock, the cli crashes (WIN7)

Code:

<code><?php
$mutex = Mutex::create();
var_dump(Mutex::lock($mutex));
?></code>

If you can tell me where the php system log is (similar to APACHE's error.log).

Just to add:

According to the official PTHREADS, it is thread-safe. In theory, thread-safety itself means protecting resources shared between multiple threads. So what is the significance of this lock? I also tried multi-threaded operation of Threaded shared resources and found that there was no problem with the final output. I don’t understand it very well. Please give me some advice

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn