For Programmers: Free Programming Magazines  


Home > Archive > IPC DirQueue > January 2008 > usage question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author usage question
Thomas J Pinkl

2007-03-03, 7:13 pm

I'm attempting to use IPC::DirQueue 0.08 for a project where messages
are queued for later processing. However, when dequeuing these
messages, it will be possible that a message cannot be processed
immediately, but could be processed later.

I thought I'd be able to use IPC::DirQueue like this:

my $dq = IPC::DirQueue->new( \%dq_opts );
while (1) {
my $job = $dq->pickup_queued_job();
last if (! $job);

my $rc = &process_job( $job );
if ($rc) {
$job->finish();
} else {
$job->return_to_queue();
}
}

But if, say, the first job is returned to the queue, then a subsequent
call to pickup_queued_job() returns that same job. Turning the loop
above into an infinite loop (absent an external event which suddenly
causes process_job() to return true).

I've read through the IPC::DirQueue and IPC::DirQueue::Job pod pages,
but I'm not seeing any way to iterate through the queue the way that I
need. The closest method I can see is visit_all_jobs(), but that only
provides read-only Job objects. I suppose I could play with the
read-only flag within the callback function, but that doesn't seem
right.

Does anyone have any suggestions?

--
Thomas J. Pinkl | T: 215-442-9300
Senior Systems Architect | 800-444-1427
Health Business Systems, Inc | F: 215-442-7555
An SXC Company |
738 Louis Drive | http://www.hbsrx.com/
Warminster, PA 18974 | http://www.sxc.com/

2007-03-05, 8:27 am


hi Thomas --

an interesting use-case I hadn't considered! ;) The problem is that
when the queue is accessed in ordered mode, it's simply a lexical
sort by filename; and when accessed in unordered mode, it's simply
the OS-based ordering rather than in any way "random".

What about re-queueing the deferred jobs? ie.

my $dq = IPC::DirQueue->new( \%dq_opts );
while (1) {
my $job = $dq->pickup_queued_job();
last if (! $job);

my $rc = &process_job( $job );
if (!$rc) {
$job->enqueue_file($job->get_data_path());
}
$job->finish();
}

in other words, if a job is to be deferred, take it off the queue
and re-queue it under a new name.

Alternatively, I'd be happy to apply a patch that implements
a version of visit_all_jobs() which allows writes somehow, or
a way to access a job returned by visit_all_jobs() and render
it writable.

--j.

Thomas J Pinkl writes:
> I'm attempting to use IPC::DirQueue 0.08 for a project where messages
> are queued for later processing. However, when dequeuing these
> messages, it will be possible that a message cannot be processed
> immediately, but could be processed later.
>
> I thought I'd be able to use IPC::DirQueue like this:
>
> my $dq = IPC::DirQueue->new( \%dq_opts );
> while (1) {
> my $job = $dq->pickup_queued_job();
> last if (! $job);
>
> my $rc = &process_job( $job );
> if ($rc) {
> $job->finish();
> } else {
> $job->return_to_queue();
> }
> }
>
> But if, say, the first job is returned to the queue, then a subsequent
> call to pickup_queued_job() returns that same job. Turning the loop
> above into an infinite loop (absent an external event which suddenly
> causes process_job() to return true).
>
> I've read through the IPC::DirQueue and IPC::DirQueue::Job pod pages,
> but I'm not seeing any way to iterate through the queue the way that I
> need. The closest method I can see is visit_all_jobs(), but that only
> provides read-only Job objects. I suppose I could play with the
> read-only flag within the callback function, but that doesn't seem
> right.
>
> Does anyone have any suggestions?
>
> --
> Thomas J. Pinkl | T: 215-442-9300
> Senior Systems Architect | 800-444-1427
> Health Business Systems, Inc | F: 215-442-7555
> An SXC Company |
> 738 Louis Drive | http://www.hbsrx.com/
> Warminster, PA 18974 | http://www.sxc.com/

Thomas J Pinkl

2007-03-05, 7:28 pm

On Mon, Mar 05, 2007 at 11:24:07AM +0000, Justin Mason wrote:
> Alternatively, I'd be happy to apply a patch that implements
> a version of visit_all_jobs() which allows writes somehow, or
> a way to access a job returned by visit_all_jobs() and render
> it writable.


Justin, here's a patch which adds an optional "readonly" parameter
to visit_all_jobs(). If the parameter isn't passed, then it defaults
to true, thus maintaining backward compatibility. The patch
includes changes to the POD as well. It's against the current SVN
source.

--
Thomas J. Pinkl | T: 215-442-9300
Senior Systems Architect | 800-444-1427
Health Business Systems, Inc | F: 215-442-7555
An SXC Company |
738 Louis Drive | http://www.hbsrx.com/
Warminster, PA 18974 | http://www.sxc.com/

Thomas J Pinkl

2007-03-05, 7:28 pm

On Mon, Mar 05, 2007 at 11:28:03AM -0500, Thomas J Pinkl wrote:
> Justin, here's a patch which adds an optional "readonly" parameter
> to visit_all_jobs(). If the parameter isn't passed, then it defaults
> to true, thus maintaining backward compatibility. The patch
> includes changes to the POD as well. It's against the current SVN
> source.


Perhaps I whipped this up too quickly. The read-only flag works, as
far as it goes, but jobs are not considered "active" when read-only
is false.

If I understand the code correctly, then I'll also have to do
something to make the job "active" from within visit_all_jobs().

Is that correct?

--
Thomas J. Pinkl | T: 215-442-9300
Senior Systems Architect | 800-444-1427
Health Business Systems, Inc | F: 215-442-7555
An SXC Company |
738 Louis Drive | http://www.hbsrx.com/
Warminster, PA 18974 | http://www.sxc.com/
Polosur

2007-03-17, 8:26 am

Carmen Electra Giving A Head And Taking A Load!
http://Carmen-Electra-Giving-A-Head...hp?movie=148803
Erleelen58

2007-05-03, 11:51 am

Cutie teasing pusy with vibro then facking hard
http://trully-bigtits.info/play.asp?bigtits218571
Adpe

2007-06-09, 11:55 pm

HaCkeD aDuLT SiTe :)
Direct access to member zone
http://uniqueadult.com/members/video.php?file=1
username: 218571
password: wanttocome
change the number in the link to get other videos! There are gigs of them!
Hadick4

2007-06-13, 2:20 am

Lindsay Lohan and Alyssa Milano , Petting Slits!
http://www.WatchingTheTube.com/WatchTube?movie=1673286


best hot sex tranny video latina teen sex video clip free sex video voyeur black free planet sex video better clip sex video
http://343-sex-video.info/porn-xxx-sex-video.html http://343-sex-video.info/teen-sex-video.html http://343-sex-video.info/free-hard-sex-video.html http://343-sex-video.info/gay-man-sex-video.html http://343-sex-video.info/homemade-sex-video.html
First

2007-06-13, 7:14 am

Britney Spears and Lindsay Lohan , Petting Slits!
http://www.WatchingTheTube.com/Watch?watch=1673286
Skylui

2007-06-16, 6:21 am

Lindsay Lohan and Paula Abdul Become Lesbians!
http://www.britneyraped.com/player.wmv?clip=1673286

Shania Twain and Helen Hunt At Pillow War Game!
http://www.britneyraped.com/PlayMovie.mpeg?clip=1673286

Halle Berry and Jessica Simpson At Pillow War Game!
http://www.britneyraped.com/watch?movie=1673286

Ashlee Simpson and Jessica Alba Lesbians Doing In Jacuzzi!
http://www.britneyraped.com/WatchTube?id=1673286

Nikki Cox and Halle Berry Tormented By Cowgirls!
http://www.britneyraped.com/Windows...v?movie=1673286

funny halo 2 video funny adult cartoon video funny dog video adult free funny video clip amazing funny video clip
http://635-funny-video.info/funny-naruto-video.html http://635-funny-video.info/free-fu...deo-e-mail.html http://635-funny-video.info/crazy-funny-video-clip.html http://635-funny-video.info/funny-junk-video-web.html http://635-funny-video.info/funny-c...video-clip.html
Ooshfala7

2007-06-26, 8:52 pm

Nice Annette is toying herself in all holes
http://girls-with-toys.info/gallery.php?id=218571
Niodecobre

2007-07-04, 5:13 am

Click here for uncensored pissing videos
Uptenjo0

2007-07-14, 3:55 am

Paula Abdul and Halle Berry Vibrating In Slits!
http://www.starpapertube.com/e?id=148803

Pamela Anderson and Alyssa Milano Tongue Tickles Lesbian Lovers Pussy Movies!
http://www.starpapertube.com/watch?id=148803

Alyson Hannigan and Angelina Jolie Vibrating In Slits!
http://www.starpapertube.com/Window...gi?watch=148803

Jennifer Aniston and Carmen Electra Teenage And Mature Lesbians Having Sex!
http://www.starpapertube.com/Player.cgi?movie=148803

Catherine Z. Jones and Olsen Twins Hardest Lesbians Wrestling Match!
http://www.starpapertube.com/a?vid=148803
Liliania

2007-07-14, 3:07 pm

Jennifer Aniston and Olsen Twins Lesbian Wrestling!
http://www.starpapertube.com/Watch?movie=148803
Tardup

2007-07-16, 8:36 am

Olsen Twins and Ashlee Simpson Wrestling & Showing Ass!
http://www.thetubebender.com/WatchTube?clip=148803

Lindsay Lohan and Christina Aguilera , Weird Lesbian Sex Act!
http://www.thetubebender.com/player.wmv?clip=148803

Jessica Alba and Catherine Z. Jones Pussy Licking & Fighting!
http://www.thetubebender.com/e?vid=148803

Christina Applegate and Jennifer Aniston Tongue Tickles Lesbian Lovers Pussy Movies!
http://www.thetubebender.com/Window...hp?watch=148803

Ashlee Simpson and Alyssa Milano Lesbian XXXXing!
http://www.thetubebender.com/Window...mv?watch=148803
Myra

2008-01-08, 7:46 pm

Helen Hunt and Paris Hilton At Pillow War Game!
Cuckmysock

2008-01-27, 5:27 pm

Nikki Cox Nude Shows Tits & Tight Ass At Home!
[url]http://www.BestGBlog.com/a?watch=726071[/url]

Hilary Swank play with dildo in fishnet stockings!
[url]http://www.BestGBlog.com/Player.cgi?vid=726071[/url]

Alyson Hannigan extreme masturbation!
[url]http://www.BestGBlog.com/MediaPlayer.wmv?clip=726071[/url]

Pamela Anderson , Pornstar MPGS!
[url]http://www.BestGBlog.com/Watch?watch=726071[/url]

Halle Berry Naughty at home!
[url]http://www.BestGBlog.com/WatchTube?watch=726071[/url]
Cuckmysock

2008-01-27, 5:30 pm

Hilary Swank and Sarah M. Gellar ,Hot Lesbians On Floor!
[url]http://www.BestGBlog.com/Player.wmv?q=726071[/url]
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com