www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - RE: synchronized (this[.classinfo]) in druntime and phobos

reply Andrew Wiley <wiley.andrew.j gmail.com> writes:
--e89a8f2353bb74b60604c1988ad0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

*>From:* mta`chrono <chrono mta-international.net>
*Sent:* Sunday, June 3, 2012 14:38:31
*To:* digitalmars-d puremagic.com
*Subject:* Re: synchronized (this[.classinfo]) in druntime and phobos


Am 30.05.2012 11:11, schrieb deadalnix:
 D already have much better tools that the one java provide
 (std.concurency, std.parallelism, TLS by default, transitive type
 qualifiers, . . .) that most these thing taken from java don't make any
 sense now.

 For instance, what is the point of being able to lock on any object when
 most of them are thread local ??

Right! Locking on non-TLS objects doesn't make sense. Perhaps only shared objects should be synchronizeable and thus contain a monitor / pointer to a monitor.

auto sthingy =3D cast(shared)thingy; As long as we support casting to/from shared, you can=92t eliminate the monitor pointer in any object. Sent from my *Windows 8 PC* <http://windows.microsoft.com/consumer-preview> --e89a8f2353bb74b60604c1988ad0 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable <html><head></head><body><div style=3D"font-family:Calibri,&quot;Segoe UI&q= uot;,Meiryo,&quot;Microsoft YaHei UI&quot;,&quot;Microsoft JhengHei UI&quot= ;,&quot;Malgun Gothic&quot;,&quot;Khmer UI&quot;,&quot;Nirmala UI&quot;,Tun= ga,&quot;Lao UI&quot;,Ebrima,sans-serif;font-size:14.66px"> <div class=3D" hide-outline">=A0</div><div class=3D" hide-outline"><strong>= &gt;From:</strong>=A0mta`chrono &lt;<a href=3D"mailto:chrono mta-internatio= nal.net">chrono mta-international.net</a>&gt;<br> &gt;<strong>Sent:</stron= g>=A0Sunday, June 3, 2012 14:38:31<br> &gt;<strong>To:</strong>=A0<a href=3D"mailto:digitalmars-d puremagic.com"=
digitalmars-d puremagic.com</a><br>		&gt;<strong>Subject:</strong>=A0Re: s=

&gt;</div> <div class=3D" hide-outline">&gt;Am 30.05.2012 11:11, schrieb deadalnix:<br=
&gt;&gt; <br>&gt;&gt; D already have much better tools that the one java p=

tive type<br> &gt;&gt; qualifiers, . . .) that most these thing taken from java don&#39;t= make any<br>&gt;&gt; sense now.<br>&gt;&gt; <br>&gt;&gt; For instance, wha= t is the point of being able to lock on any object when<br>&gt;&gt; most of= them are thread local ??<br> &gt; <br>&gt; Right! Locking on non-TLS objects doesn&#39;t make sense. Per= haps only<br>&gt; shared objects should be synchronizeable and thus contain= a monitor /<br>&gt; pointer to a monitor.<br></div><div><div class=3D" hid= e-outline"> auto thingy =3D new Thing();</div><div class=3D" hide-outline">auto sthingy= =3D cast(shared)thingy;</div><div class=3D" hide-outline">=A0</div><div cl= ass=3D" hide-outline">As long as we support casting to/from shared, you can= =92t eliminate the monitor pointer in any object.</div> <div class=3D" hide-outline">=A0</div><div class=3D" hide-outline">=A0</div=
<div class=3D" hide-outline">Sent from my <a href=3D"http://windows.micros=

</a></div>

--e89a8f2353bb74b60604c1988ad0--
Jun 03 2012
parent =?windows-1252?Q?Alex_R=F8nne_Petersen?= <alex lycus.org> writes:
On 04-06-2012 00:00, Andrew Wiley wrote:
 *>From:* mta`chrono <chrono mta-international.net
 <mailto:chrono mta-international.net>>
  >*Sent:* Sunday, June 3, 2012 14:38:31
  >*To:* digitalmars-d puremagic.com <mailto:digitalmars-d puremagic.com>
  >*Subject:* Re: synchronized (this[.classinfo]) in druntime and phobos
  >
  >
  >Am 30.05.2012 11:11, schrieb deadalnix:
  >>
  >> D already have much better tools that the one java provide
  >> (std.concurency, std.parallelism, TLS by default, transitive type
  >> qualifiers, . . .) that most these thing taken from java don't make any
  >> sense now.
  >>
  >> For instance, what is the point of being able to lock on any object when
  >> most of them are thread local ??
  >
  > Right! Locking on non-TLS objects doesn't make sense. Perhaps only
  > shared objects should be synchronizeable and thus contain a monitor /
  > pointer to a monitor.
 auto thingy = new Thing();
 auto sthingy = cast(shared)thingy;
 As long as we support casting to/from shared, you can’t eliminate the
 monitor pointer in any object.
 Sent from my _Windows 8 PC_ <http://windows.microsoft.com/consumer-preview>

(And let me just add: As long as shared is as impractical as it is, we shouldn't remove that ability.) -- Alex Rønne Petersen alex lycus.org http://lycus.org
Jun 03 2012