Related articles |
---|
[3 earlier articles] |
Re: Promoting weak pointers m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-06-16) |
Re: Promoting weak pointers m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-06-16) |
Re: Promoting weak pointers m.helvensteijn@gmail.com (Michiel Helvensteijn) (2009-06-17) |
Re: Promoting weak pointers bobduff@shell01.TheWorld.com (Robert A Duff) (2009-06-17) |
Re: Promoting weak pointers andrew@tomazos.com (Andrew Tomazos) (2009-06-18) |
Re: Promoting weak pointers armelasselin@hotmail.com (Armel) (2009-06-19) |
Re: Promoting weak pointers dot@dotat.at (Tony Finch) (2009-06-19) |
From: | Tony Finch <dot@dotat.at> |
Newsgroups: | comp.compilers |
Date: | 19 Jun 2009 13:15:35 +0100 (BST) |
Organization: | dotat labs |
References: | 09-06-047 09-06-055 09-06-057 09-06-060 |
Keywords: | linker, parallel |
Posted-Date: | 21 Jun 2009 16:49:17 EDT |
Robert A Duff <bobduff@shell01.TheWorld.com> wrote:
>Michiel Helvensteijn <m.helvensteijn@gmail.com> writes:
>
>> On Jun 16, 12:39 pm, Andrew Tomazos <and...@tomazos.com> wrote:
>>> if (my_weak_ptr != NULL)
>>> my_weak_ptr->do_something();
>
>> [Now I'm confused, too. This is an ordinary race condition of the kind
>> that every parallel program has to handle, and would present the same
>> issues no matter what kind of pointer it is. -John]
>
>It seems different, because in this case, the race condition is caused
>by the implementation (i.e. the garbage collector), not by the
>application.
I disagree. Weak pointers are inherently racy, so you have to write the
code to cope with that fact. For example,
ptr_copy = my_weak_ptr;
if (ptr_copy != NULL)
ptr_copy->do_something();
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
FORTIES CROMARTY FORTH TYNE DOGGER: SOUTH VEERING WEST OR SOUTHWEST 5 TO 7,
OCCASIONALLY GALE 8 AT FIRST EXCEPT IN CROMARTY. MODERATE OR ROUGH. RAIN THEN
SHOWERS. MODERATE OR POOR BECOMING GOOD.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.