lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: [PHP] FW: [SPAM] [PHP] FIFO files on PHP?
- Date: Mon, 25 Aug 2008 16:22:10 -0700
- From: "Waynn Lue" <waynnlue@xxxxxxxxx>
- Subject: ***BOGO*** Re: [PHP] FW: [SPAM] [PHP] FIFO files on PHP?
On Wed, Jul 2, 2008 at 1:22 AM, Chris Scott <Chris.Scott@xxxxxxxxxx> wrote:
> > -----Original Message-----
> > From: Waynn Lue [mailto:waynnlue@xxxxxxxxx]
> > Sent: Tuesday, July 01, 2008 11:06 PM
> > To: php-general@xxxxxxxxxxxxx
> > Subject: [SPAM] [PHP] FIFO files on PHP?
> > Importance: Low
> >
> > I'm trying to build a queue out using FIFO files (someone on the MySQL
> > list suggested checking them out instead of using the database), but
> > I'm running into a problem because of the synchronous fwrite call.
> > Here's the code:
> >
> > $fifoFile = '/tmp/fifo';
> > if (!file_exists($fifoFile)) {
> > posix_mkfifo($fifoFile, 0600);
> > }
> > $fp = fopen($fifoFile, "w");
> > fwrite($fp, "content");
> > fclose($fp);
> >
> > But this will block until something actually reads the pipe. Is there
> > any way to write to the pipe, then go away as opposed to waiting until
> > something consumes it? Otherwise, I may just go back to a database
> > table.
> >
> > Thanks,
> > Waynn
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> Fifo nodes are equivalent to a pipe (|) and have no size on the file
> system and therefore the write won't finish until some process reads
> from the node. See the man page http://linux.die.net/man/7/fifo .
>
Wow, my mail client filtered these responses so I only just noticed them--I
thought there were no responses. Thanks for letting me know, I ended up
using threads to accomplish something similar.