Closed hashworks closed 9 years ago
I have never experienced the need to recompile PHP in order to get pcntl_fork to work, that being said i have always used default Ubuntu/Debian/Red Hat packages, so i doubt that it would be big issue.
I'm not talking about process forking but actual threading using pthreads: http://php.net/manual/de/class.thread.php
I would prefer that because of the IPC and zombie problems when using forks.
Ah, then i understand, and yes, i was a bit worried about the zombie issues myself.
My approach: VikingBot-Class instance A creates Plugin-Class instance B. A creates Threaded-Class instance C with B as a parameter. A tells C to call B threaded. The problem: As soon as I give B to C, the socket in B turns to int(0).
I'm not absolutely sure what's the cause.
Seems like sending resources to a pthread is a bad idea.
Any alternative?
Not that i can think of yet.
That's a big maybe. When multiple users request time intensive commands the bot can get quite slow. Threaded plugin calls could avoid that. But I need to take some time looking into the PHP threaded system, never used it. I think you also need to recompile PHP, so it's kind of optional for the man in the street.
PS: I'll post stuff I'll work on over the next days. Feel free to implement them if you find time.