<div dir="ltr"><div dir="ltr"><div>Thanks to Squeak.js, I was able to trace this back to Squeak 1.13u [1] when EventSensor was called "InputState" (see screenshot below). At that time, the semaphore was in use and that also explains why Squeak.js is supporting it. I also found some details on polling vs. event loop in VisualWorks (see [2], "3.5.1. How User-Interface Events Work in VisualWorks"). There are some other related discussions (e.g. [3]), I have the feeling that there was a good reason to move from an event to a polling loop.</div><div><br></div><div>May I suggest we clean the code up for 5.3 now, and experiment with an event-based loop after the release?</div><div><br></div><div>Fabio</div><div><br></div><div>[1] <a href="https://squeak.js.org/run/#url=https://freudenbergs.de/bert/squeakjs&files=[Squeak1.13u.image,Squeak1.13u.changes,SqueakV1.sources]&swapButtons=true">https://squeak.js.org/run/#url=https://freudenbergs.de/bert/squeakjs&files=[Squeak1.13u.image,Squeak1.13u.changes,SqueakV1.sources]&swapButtons=true</a></div><div>[2] <a href="https://joeyoder.com/Research/cblend-doc/index2.html">https://joeyoder.com/Research/cblend-doc/index2.html</a></div><div>[3] <a href="http://forum.world.st/Discard-the-event-tickler-process-tp4888251p4888291.html">http://forum.world.st/Discard-the-event-tickler-process-tp4888251p4888291.html</a></div><div><br></div><div><img src="cid:ii_k68a42hr0" alt="image.png" width="542" height="384"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 4, 2020 at 1:40 PM Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu">leves@caesar.elte.hu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I tried to find more information about the semaphore based approach, and <br>
to me it seems that sometime somewhere someone decided it's a good idea <br>
to poll instead of waiting for a semaphore.<br>
So, the semaphore is signaled by the VM when a new event is available (I <br>
tested it on linux, and according to emails, Andreas fixed it for windows <br>
back in 2009), but the image doesn't use the semaphore.<br>
I tried to understand how the delay of 500ms gets worked around and the <br>
events not get stalled, but I couldn't.<br>
<br>
I see no point in polling for events when we have a semaphore available.<br>
So, I think we should investigate whether polling is really a better <br>
choice than the semaphore.<br>
<br>
<br>
Levente<br>
<br>
On Mon, 3 Feb 2020, Fabio Niephaus wrote:<br>
<br>
> Hi all,<br>
> <br>
> I think Tim is correct and this is an old artifact from the previous and semaphore-based event mechanism.<br>
> <br>
> Does anyone object to merging this into trunk (with the class comment fixed of course)? It's a simple cleanup, not a new feature.<br>
> <br>
> Fabio<br>
> <br>
> <br>
> On Thu, Jan 30, 2020 at 2:31 AM tim Rowledge <<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>> wrote:<br>
>       As best I can recall we used to signal the input sem from the vm when a key event came in. We also used to signal a specific interrupt key semaphore, which had the great virtue of really making sure the image got<br>
>       the message that you wanted it to stop chewing gum and pay attention *right now*young fella.<br>
><br>
>       > On 2020-01-29, at 5:00 PM, David T. Lewis <<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>> wrote:<br>
>       ><br>
>       > On Wed, Jan 29, 2020 at 05:47:15PM +0000, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
>       >> A new version of Kernel was added to project The Inbox:<br>
>       >> <a href="http://source.squeak.org/inbox/Kernel-fn.1294.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Kernel-fn.1294.mcz</a><br>
>       >><br>
>       >> ==================== Summary ====================<br>
>       >><br>
>       >> Name: Kernel-fn.1294<br>
>       >> Author: fn<br>
>       >> Time: 29 January 2020, 6:47:12.028071 pm<br>
>       >> UUID: 0b61cdfe-41e2-4aee-a5f0-80d8e7d45127<br>
>       >> Ancestors: Kernel-tonyg.1293<br>
>       >><br>
>       >> Remove inputSemaphore and hasInputSemaphore from EventSensor (both are no longer in use). Also drop EventSensor>>primSetInputSemaphore:.<br>
>       >><br>
>       ><br>
>       > Is it actually the case that inputSemaphore and hasInputSemaphore are<br>
>       > no longer in use? They appear to be used now in exactly the same way<br>
>       > they were used in Squeak 3.8. But in Squeak 3.6, the inputSemaphore was<br>
>       > waited on by an ioProcess, so it looks like it served a useful purpose<br>
>       > back then.<br>
>       ><br>
>       > So yes, this actually does appear to be dead code that has been waiting<br>
>       > all these years for cleanup :-)<br>
>       ><br>
>       > Dave<br>
>       ><br>
>       ><br>
>       ><br>
> <br>
><br>
>       tim<br>
>       --<br>
>       tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" rel="noreferrer" target="_blank">http://www.rowledge.org/tim</a><br>
>       "Bother," said Pooh, reading his bank statement from Barings.<br>
> <br>
> <br>
> <br>
> <br>
><br>
<br>
</blockquote></div></div>