--_000_710DF26F214D2B4BB94287123FFE980A2DD02CAA8DNAEXMSGC104re_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

Thread.critical= is supposed to not schedule any other thread, in addition to guaranteeing that only one thread is ever in the block with Thread.critical==true. This is easier to support with green threads.

With native threads, it is harder to do. I am working on IronRuby, and haveome questions:

1. Should it be by spec that other threads are not allowed to be scheduled?hread#inspect for the other threads actually says "run", not "sleep".

2. How would you test that the other threads are not scheduled. It can be done by having the other threads increment some class variable, and by checking that its value does not change. So this is mostly a rhetorical question.

3. Given that implementations with native threads cannot support this perfectly, how many apps would actually be affected? The few gems I have looked at only need that Thread.critical=true only behave like a critical section. The apps will work even if the other threads are scheduled, as long the other threads block when they themselves try to set Thread.critical=true.ccording to http://www.megasolutions.net/ruby/basic-threading-question_can-ruby-use-real-threads_-64225.aspx, JRuby supports this by having every thread periodically do a checkpoint to see if it should suspend itself. It seems that most apps would continue working if there was only one checkpoint,in Thread.critical=.

Thanks,
Shri


--_000_710DF26F214D2B4BB94287123FFE980A2DD02CAA8DNAEXMSGC104re_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>Hi,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thread.critical= is supposed to not schedule any other
thread, in addition to guaranteeing that only one thread is ever in the block
with Thread.critical==true. This is easier to support with green threads. <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>With native threads, it is harder to do. I am working on
IronRuby, and have some questions:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>1. Should it be by spec that other threads are not allowed
to be scheduled? Thread#inspect for the other threads actually says &#8220;run&#8221;,
not &#8220;sleep&#8221;.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>2. How would you test that the other threads are not
scheduled. It can be done by having the other threads increment some class
variable, and by checking that its value does not change. So this is mostlyhetorical question.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>3. Given that implementations with native threads cannot
support this perfectly, how many apps would actually be affected? The few gems I
have looked at only need that Thread.critical=true only behave like a critical
section. The apps will work even if the other threads are scheduled, as long
the other threads block when they themselves try to set Thread.critical=true. According
to <a
href="http://www.megasolutions.net/ruby/basic-threading-question_can-ruby-use-real-threads_-64225.aspx">http://www.megasolutions.net/ruby/basic-threading-question_can-ruby-use-real-threads_-64225.aspx</a>,
JRuby supports this by having every thread periodically do a checkpoint to see
if it should suspend itself. It seems that most apps would continue workingf
there was only one checkpoint,in Thread.critical=.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thanks,<o:p></o:p></p>

<p class=MsoNormal>Shri<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

--_000_710DF26F214D2B4BB94287123FFE980A2DD02CAA8DNAEXMSGC104re_--