• PHP uses pthreads V3 Multithread to achieve Sina News information capture operation example


    This article describes how PHP uses pthreads V3 multithreading to capture Sina News Information. The details are as follows: We use pthreads to write a multithreaded page grabbing applet and store the results in the database. The data table structure is as follows: CREATE TABLE `tb_sina` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT ‘ID’, […]

  • Analysis of some pitfalls and points for attention in using PHP pthreads V3


    This article describes some pitfalls and points for attention in using PHP pthreads V3 with examples. The details are as follows: 1、 The child thread cannot access the global variables of the parent thread, but the parent thread can access the variables of the child thread <?php class Task extends Thread { public $data; public […]

  • Introduction and example of volatile in PHP pthreads V3


    This article describes the introduction and usage of volatile in PHP pthreads v3. The details are as follows: Because the concept of automatic invariance of threaded object is introduced in ptthreads V3, when we set the member as an array in the constructor, we cannot rewrite the member in other places. Examples are as follows: […]

  • Examples of synchronized usage in PHP pthreads V3


    This paper introduces the usage of synchronized in PHP pthreads v3. The details are as follows: Synchronization is used because if multiple threads operate on the same resource, there will be confusion. For example, two threads add one to a variable. Before the first thread arrives and rewrites the data, the second thread operates on […]

  • Examples of using worker and pool in PHP pthreads V3


    This article describes the use of worker and pool in PHP pthreads v3. The details are as follows: Some people will think, clearly using thread can already work well, why do you want to set up a worker and pool? The reason why we need to use worker and pool is because of efficiency, because […]

  • How to install and configure PHP pthreads V3 on centos7 platform


    This paper introduces the installation and configuration of PHP pthreads V3 on centos7 platform. The details are as follows: My CentOS version is 7.4.1708, and PHP version is 7.2.4 (pay attention to thread safe version), as shown in the figure below: First of all, we can download the source code of pthreads from the following […]

  • Using C + + to encapsulate mutex and conditional variables


    In this paper, C + + raii mechanism is used to encapsulate the mutex and condition variables, so that they can automatically manage the life cycle of mutex and condition variables, and avoid the resource leakage caused by manual maintenance. This article uses pthread Library under Linux. mutex MutexLock First, the mutex is encapsulated. The […]

  • Ubuntu compiler installs PHP 7.2 + compiler pthreads


    Compiler environment Ubuntu 18.04 LTS Server (16.04 Desktop also compiled) version, usingsudo lsb_release -aSeeThe compiled PHP version is7.2.6 Apache Installation sudo apt install apache2 apache2-dev Constructing Environment sudo apt install build-essential Get the source code Go to http://php.net/downloads.php to download the source code (you can choose the mirror near you), here you choose is*.xzVersion, smaller […]