<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<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 name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></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=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>That’s a very roundabout way to do it.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Simply set the channel’s preference to 1 (sender preference) and the receiver will be scheduled to run in its own good time.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>K<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> stackless-bounces@stackless.com [mailto:stackless-bounces@stackless.com] <b>On Behalf Of </b>David Butler<br><b>Sent:</b> 18. apríl 2011 23:57<br><b>To:</b> The Stackless Python Mailing List<br><b>Subject:</b> Re: [Stackless] Watchdog and Channel Receiving in C<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p>It turns out that the problem was in how I was sending the message.  I was sending straight from C with PyChannel_Send(), and it was firing off all the code immediately.  If I instead spawn a tasklet that sends the message, everything is scheduled under the watchdog properly.<o:p></o:p></p><div><p class=MsoNormal>On Apr 18, 2011 6:26 PM, "Richard Tew" <<a href="mailto:richard.m.tew@gmail.com">richard.m.tew@gmail.com</a>> wrote:<br>> On Tue, Apr 19, 2011 at 1:34 AM, Dave Butler <<a href="mailto:dave@hoppit.net">dave@hoppit.net</a>> wrote:<br>> <br>>> I've browsed through some of the stackless code, and I'm not entirely sure<br>>> what is happening in there. It appears to me that when data is received on<br>>> a channel, it immediately fires off the rest of the function rather than<br>>> scheduling it for execution? I may be entirely wrong here...<br>>><br>>> Has anyone encountered this at all? I'm happy to delve into and make<br>>> changes to the stackless code if necessary, or if someone knows a better<br>>> method to achieve the same thing I would appreciate any pointers. I would<br>>> prefer to go under the assumption that script-writers do NOT know how<br>>> stackless works and should not be required to do any cooperative scheduling<br>>> themselves. Feel free to let me know if I was unclear on any particular<br>>> points.<br>>><br>> <br>> Hi Dave,<br>> <br>> How a channel behaves with regard to scheduling when an operation is<br>> performed on it, is determined by its preference attribute. See this entry:<br>> <br>> <br>> <a href="http://disinterest.org/resource/stackless/2.6-docs-html/library/stackless/channels.html#channel.preference">http://disinterest.org/resource/stackless/2.6-docs-html/library/stackless/channels.html#channel.preference</a><br>> <br>> And this entry:<br>> <br>> <br>> <a href="http://disinterest.org/resource/stackless/2.6-docs-html/library/stackless/channels.html#channel.schedule_all">http://disinterest.org/resource/stackless/2.6-docs-html/library/stackless/channels.html#channel.schedule_all</a><br>> <br>> Cheers,<br>> Richard.<o:p></o:p></p></div></div></div></body></html>