Yii Framework Context in Pthread Class


I’m working on Pthreads. I have written a class which inherits the “Thread” class. This class does not recognize the Yii (1.x) framework context. I cannot use any of the Yii framework components or models. I have made sure the thread class should reside in the Yii framework’s accessible paths defined in the “import” in configuration.

Here is an example how I wrote the thread class.



class MultiThreaded extends Thread {


	public function __construct(){



	public function run(){

                   echo Yii::app()->basePath;





Am I doing something wrong ?



Hi arfeen

Although I have never use pthread I just read has some issues

Do you run the controller/action by console or in browser?

What exactly you want to do?

Maybe you could achieve it by another way

Hi Kostaz

Sorry for the delayed reply, as I got engaged on some other project.

Actually I wanted to use PThreads in CLI applications. I just wanted to test the PThread so that I can use it in some usefull things but ended up in having problem of missing Yii context inside PThread class.