<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=iso-8859-1">
<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:0cm;
        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:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        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:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:1374426887;
        mso-list-type:hybrid;
        mso-list-template-ids:1668297636 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</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><span lang=IS>Okay, I&#8216;ve managed to simplify this a
bit.<o:p></o:p></span></p>

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

<p class=MsoNormal><span lang=IS>Run the attached program and watch stackless
get confused.<o:p></o:p></span></p>

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

<p class=MsoNormal><span lang=IS>The point is that I am fiddling with
sys.setprofile() in the context switch callback.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=IS>I do this for a reason:  I assume that this is
a global state, and I want to temporarily turn off profiling in this function
because I am doing task switch bookkeeping for the profiler.<o:p></o:p></span></p>

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

<p class=MsoNormal><span lang=IS>Let me repeat the issues that need solving:<o:p></o:p></span></p>

<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span
lang=IS><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=IS>stackless shouldn&#8216;t freak
out at this.  Some frames are obviously being rescheduled or something.<o:p></o:p></span></p>

<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span
lang=IS><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=IS>I need to be able to turn on
profiling for all tasklets, as a global state, to snapshot a running program.<o:p></o:p></span></p>

<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span
lang=IS><span style='mso-list:Ignore'>3)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=IS>the sys.setprofile() and
stackless.</span><span lang=IS> </span><span lang=IS>set_schedule_callback do
not return the previous value so it is impossible to temporarily set/unset them
and then restore them.<o:p></o:p></span></p>

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

<p class=MsoNormal><span lang=IS>For 2), I am thinking about adding a flag to
stackless, stackless.tracing or something, to enable the old (thread) global
behaviour.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=IS>For 3) I think the change should be
straightforward.  I don&#8216;t understand why sys.setprofile() isnt&#8216;t
this way already.<o:p></o:p></span></p>

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

<p class=MsoNormal><span lang=IS>K<o:p></o:p></span></p>

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

</div>

</body>

</html>