From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a6414d7d26b803ce X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!postnews.google.com!o32g2000yqm.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada and (SIGTERM?) Date: Sun, 16 Aug 2009 08:47:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <42c9446c-76d2-4c82-abab-fd7c5573d85e@k30g2000yqf.googlegroups.com> <4244cbe7-1655-484b-a376-0237802ab37d@p10g2000prm.googlegroups.com> <103641e8-0738-4b10-b2c6-cbfb53b50d98@d34g2000vbm.googlegroups.com> <52dab4e5-9ee0-4e01-9072-32a95caadb84@j19g2000vbp.googlegroups.com> <7c4f9e5c-73a3-40af-a247-c44c858b8742@k26g2000vbp.googlegroups.com> <3d68abb8-0f8e-42fc-b576-24c320dd0bbc@d32g2000yqh.googlegroups.com> NNTP-Posting-Host: 83.77.232.128 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1250437640 13419 127.0.0.1 (16 Aug 2009 15:47:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 16 Aug 2009 15:47:20 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o32g2000yqm.googlegroups.com; posting-host=83.77.232.128; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7832 Date: 2009-08-16T08:47:19-07:00 List-Id: On 16 Sie, 15:11, Tomek Wa=C5=82kuski 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