comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Ada and (SIGTERM?)
Date: Sun, 16 Aug 2009 08:47:19 -0700 (PDT)
Date: 2009-08-16T08:47:19-07:00	[thread overview]
Message-ID: <f6c9cf71-47d1-4a06-8325-7917ad8476a0@o32g2000yqm.googlegroups.com> (raw)
In-Reply-To: 3d68abb8-0f8e-42fc-b576-24c320dd0bbc@d32g2000yqh.googlegroups.com

On 16 Sie, 15:11, Tomek Wałkuski <tomek.walku...@gmail.com> wrote:

> And... how to quit all of them? I cannot force all workers and manager
> to look at Quit flag in protected object.

If you use the queue of work items, a possible strategy is to define a
special value for the work item[*], so-called "poison pill", that will
be recognized by workers and cause them to quit. If you have N workers
(and you better know how many there are), then just push N "poison
pills" into the queue and it's over.

The poison pill strategy can be also used when there is no queue and a
single manager decides who will get the next work item for processing.

[*] if work items are passed around by pointers (access values), then
null value is a good candidate.

> If workers are looking at Quit flag (and manager is not) everything
> terminates, but I have to fire SIGTERM signal 6 times (when I have 5
> workers).

Why? Do you clear the Quit flag when it is read?

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

Database Access Library for Ada: www.inspirel.com/soci-ada



      reply	other threads:[~2009-08-16 15:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05 19:58 Ada and (SIGTERM?) Tomek Walkuski
2009-08-06  1:06 ` Adam Beneschan
2009-08-06 18:13   ` sjw
2009-08-06 18:48     ` Adam Beneschan
2009-08-06 19:30   ` Tomek Wałkuski
2009-08-06 19:57     ` Jeffrey R. Carter
2009-08-06 20:02       ` Tomek Wałkuski
2009-08-06 20:00     ` okellogg
2009-08-08 13:11     ` Tomek Wałkuski
2009-08-08 15:06       ` Maciej Sobczak
2009-08-08 17:53         ` Tomek Wałkuski
2009-08-16 13:11           ` Tomek Wałkuski
2009-08-16 15:47             ` Maciej Sobczak [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox