Re: Write my own extenmsion
| From: | Christian Lange | Date: | Fri, 20 Jun 2008 11:22:08 +0000 |
| Subject: | Re: Write my own extenmsion | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5556@lists.php.net to get a copy of this message | ||
Lars Strojny schrieb:
> Hi Christian,
>
> Am Donnerstag, den 19.06.2008, 17:05 +0200 schrieb Christian Lange:
>
>> Hi, i have written my own php extension. Now i would publishing it on
>> PECL, who other peaople can test it.
>>
>
> Do you have some code to read somewhere?
>
>
Excample php code or the c extension code?
>> The extension implements a class, which you start a new thread and run
>> paralel php code.
>> I have written this extension with looking into runkit extension.
>>
>
> That sounds pretty cool and helpful in some cases.
>
>
>> // thread class to create one thread per instance, in every thread you
>> can not access functions/methodes in other threads.
>>
>
> So you create a whole new scope for the thread? Say I have class "Foo"
> included in the parent thread, is the class "Foo" (not the object)
> available in the child thread?
>
>
Every thread has his own scope, that mean a defined class is only
visible in the thread scope not in a parent thread scope.
>> class clthread {
>>
>
> The prefix "cl" stands for?
>
>
>> public __construct();
>> public void deattach();
>> public void eval();
>> public bool isdoing();
>>
>
> I would prefer "isRunning". Another hint: PHP has some coding guidelines
> regarding e.g. names. We prefer camel-case for class names ("FooBar")
> and lowercase camel-case ("fooBar") for method names.
>
>
>> public void die();
>> public void exit();
>> };
>>
>
>
>> class clmemory {is syncon
>> public __construct();
>> };
>>
>
> The class clmemory is just a property bag? So the user can stick various
> values in? How are the different threads supposed to access it?
>
> cu, Lars
>
Yes, in every thread is the clmemory synchronous
Thread1:
$clmemory->abc = "Hallo";
Thread2:
echo $clmemory->abc;
or
Thread1:
$clmemory->i = 0;
while(1) {
$clmemory->i++;
}
Thread2:
while(1) {
echo $clmemory->i."\r";
}
regards Christian L.