Re: Promoting weak pointers

"Armel" <armelasselin@hotmail.com>
Fri, 19 Jun 2009 13:37:57 +0200

          From comp.compilers

Related articles
[2 earlier articles]
Re: Promoting weak pointers andrew@tomazos.com (Andrew Tomazos) (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-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)
| List of all articles for this month |
From: "Armel" <armelasselin@hotmail.com>
Newsgroups: comp.compilers
Date: Fri, 19 Jun 2009 13:37:57 +0200
Organization: Compilers Central
References: 09-06-047 09-06-055 09-06-057 09-06-059
Keywords: linker, parallel
Posted-Date: 21 Jun 2009 16:48:56 EDT

> Agreed. Andrew simply suggested that one way to avoid the the
> destruction of the object (by thread A) between the test and the
> access (in thread B) is to first promote the weak pointer in thread B
> to temporarily keep the object alive.


Unless you are happy with 'this' becoming null during the execution of a
function (which by the way can be useful in rare cases, but may require a
specific notation with a prototype like "public int myfunction(params)
weak").


imagining your implicit "this" is strong, you can also note that it is what
you _will_ do whatever the case using "my_ptr->function"
because here "->" _always_ promote to strong pointer. so this promotion is
forcefully existing in your language.
promoting to strong by hand before the test "ptr != null" would be just an
explicit way to do it: no new runtime code to implement.


Regards
Armel



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.