PHP Multi-threaded learning

Source: Internet
Author: User

Questions:

1. After the code in the Run method finishes executing, the standalone thread exits immediately and waits for the appropriate time to be joined by the creator thread.

can only creator threads join join, and what is join?

2, Thread extends threaded implements countable , traversable , arrayaccess {}

is threaded an interface? How to use the interface?

Summary:

Thread class

The following pattern is: public-private Property The "static" return value belongs to the class:: Method name (parameter)

1, public integer thread::getcreatorid ( void)

Returns the thread ID that created the current thread.

Usage: Create a thread object that can be called inside a class:$this->getCreatorId();

2,public static Thread thread::getcurrentthread ( void)

Gets a reference to the current thread of execution.

Usage:public function run() {
        var_dump(Thread::getCurrentThread());
    }

3,public static integer thread::getcurrentthreadid ( void)

Returns the ID of the current thread of execution

PHP Multi-threaded learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.