Summary
In this chapter, we went through two larger topics. We'll use both of them in the next chapter, where we'll write multithreaded applications with pthreads, as well as distributed applications with Gearman.
The two topics we covered were multicasting in RxPHP and all operators related to it, and using the PHP7 pthreads v3 extension to write multithreaded PHP7 applications.
Multicasting in Rx is very useful in order to share a single connection to source Observables without resubscribing. This comes with the refCount()
operator to work more easily with ConnectableObservables
.
Multithreaded programming in PHP is possible with the pthreads extension. However, it's not as simple as it seems, and there are multiple caveats, most importantly insufficient documentation and an overall unintuitive approach. In the next chapter, we'll use just the most basic functions from pthreads to avoid confusion and eventual inconsistency with future updates of pthreads. The goal for...