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

php pthreads CLI has stop when using mutex

WBOY
Release: 2023-03-01 21:10:01
Original
1475 people have browsed it

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

Code:

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

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>
Copy after login
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template