[PHP] Shared memory, mutex functionality and spawning threads. Is it possible using PHP?

2008-09-01 Thread Kent Larsson
Hi,

Is it possible to have shared memory in the form of shared global variables
in PHP? Or any other form of shared memory? And if that is the case, is
there any form of mutex functionality which may be used to assure
syncronized access to this memory?

My next question is related to the first one.

Is it possible to have a thread running for processing of information. This
thread should be accessed from all the session instances, and it would also
need to be syncronized. I would like to have something like:
jobProcessorThread.addJob(aJobClassInstance)

The job processor thread should work with the jobs in its queue until the
queue is empty. Then it should idle until more requests are received.

And my last question.

Is it possible to let any code run and perform its work after PHP has sent
the page to the user? This could be an alternative to having a worker thread
in if it's also possible to have mutexes and shared memory. Then the worker
thread jobs could be processed after a page has been sent inside a critical
block protected by mutex functionality.

Best regards,
Kent


Re: [PHP] Shared memory, mutex functionality and spawning threads. Is it possible using PHP?

2008-09-01 Thread Kent Larsson
Hi,

Thank you for your answer. I was hoping there were a solution. :-/ It would
have been nice as PHP has a large install base and is a quite common element
in cheap web hosting solutions. Has anyone else got any more comments or
suggestions?

In absence of shared memory and threads. What I really must have is some
kind of mutex functionality. I will be manipulating files on disk and I
don't want two instances to be able to touch the disk at the same time. Is
there something I could use for mutual exclusion? If there aren't any
dedicated methods, are there 100% reliable workarounds?

On Mon, Sep 1, 2008 at 8:27 PM, Per Jessen <[EMAIL PROTECTED]> wrote:

> Kent Larsson wrote:
>
> > Hi,
> >
> > Is it possible to have shared memory in the form of shared global
> > variables in PHP? Or any other form of shared memory? And if that is
> > the case, is there any form of mutex functionality which may be used
> > to assure syncronized access to this memory?
> >
> > My next question is related to the first one.
>
> I can't answer any of your questions, but if you need shared memory,
> mutexes and threading, I would advice against using PHP.
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>