Home >PHP Framework >Workerman >Is workerman multi-threaded?
Workerman has a MT multi-threaded version that relies on the pthreads extension. However, because the pthreads extension is not stable enough, this Workerman multi-threaded version is no longer maintained.
Currently Workerman and its peripheral products are based on multi-process and single-thread. (Recommended learning: workerman tutorial)
Coding specifications in WorkerMan
1. Classes are capitalized Camel case naming, the class file name must be the same as the internal class name of the file for automatic loading. For example:
class UserInfo { ...
2. Use a namespace. The namespace name corresponds to the directory path, and is based on the developer's project root directory.
For example, in the project MyApp/, the class file MyApp/MyClass.php is in the project root directory, so the namespace is omitted. The class file MyApp/Protocols/MyProtocol.php because MyProtocol.php is in the Protocols directory of the MyApp project, so the namespace Protocols must be added; as follows:
namespace Protocols; class MyProtocol { ....
3. Common function and variable names use The format is lowercase and underlined, for example
$connection_list = array(); function get_connection_list() { ....
4. Class members and class methods are in camel case with the first letter in lowercase, for example:
public $connectionList; public function getConnectionList();
5. Function and class parameters are in lowercase and underlined
function get_connection_list($one_param, $tow_param) { ....
The above is the detailed content of Is workerman multi-threaded?. For more information, please follow other related articles on the PHP Chinese website!