develooper Front page | perl.perl6.language | Postings from June 2006

RE: Synchronized / Thread syntax in Perl 6

Thread Previous | Thread Next
From:
Paul Hodges
Date:
June 2, 2006 14:11
Subject:
RE: Synchronized / Thread syntax in Perl 6
Message ID:
20060602211122.61577.qmail@web31615.mail.mud.yahoo.com
--- John Drago <john.drago@precissystems.com> wrote:
. . .
> >  class QueueRunner {
> >    our sub process_queue(Code @jobs_in) {
> >      my @ans is serial;
> >      @ans.push map { async { &_() } } @jobs_in;
> >      @ans;
> >    }
> >  }
> >  my @answer = QueueRunner.process_job_queue( @jobs );
> 
> Actually I think you did it just right.
> I think that horse is dead now.

LOL!! I'm flattered. =o)

> So, what about "serial" classes and methods?:
> 
> # Does marking this class "is serial" mean it's forced to be a
> singleton?

Hmm.... I wouldn't think so. You should still be able to spawn object
instances, but I'd say it scopes the lock to the whole class, so that
everything in that container is locked any time anything in the class
in accessed. It's a cheap way to make all shared resources queue up
nicely, if you just want a quick and dirty script instead of something
well streamlined. Kind of like locking at the DB or table level instead
of just the row, but there are times when that's what you need.

. . . 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About