[Vm-dev] Re: [Pharo-users] Get "Invalid utf8 input detected"
error for a filename
Igor Stasenko
siguctua at gmail.com
Thu Mar 24 22:11:04 UTC 2011
On 24 March 2011 22:12, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
>
>
> On Thu, Mar 24, 2011 at 2:12 PM, stephane ducasse <stephane.ducasse at gmail.com> wrote:
>>
>> >
>> > Clearly we need to do a careful merge of the http://www.squeakvm.org/svn/squeak/branches/Cog/platforms tree with http://squeakvm.org/svn/squeak/trunk/platforms tree. There are important improvements from Cog:
>> > - time based on 64-bit microseconds
>> > - better crash/logging stack backtrace reporting
>> > - concurrent lock-free external semaphore signalling
>> > - threaded stdio
>> > - vm version info
>> > - others?
>>
>> Elliot do you know if any of these issues include the fix that igor sent long time ago about the semaphore
>> for event input (because it is missing on windows) and with it we will be able to remove the polling behavior for events.
>
> No idea. Sorry.
Here it is:
primSetInputSemaphore: semaIndex
"Set the input semaphore the VM should use for asynchronously
signaling the availability of events. Primitive. Optional."
<primitive: 93>
^nil
On unix (platforms/unix/vm/sqUnixMain.c):
/* set asynchronous input event semaphore */
sqInt ioSetInputSemaphore(sqInt semaIndex)
{
if ((semaIndex == 0) || (noEvents == 1))
success(false);
else
inputEventSemaIndex= semaIndex;
return true;
}
and then you see there is calls to:
static void signalInputEvent(void)
{
#if DEBUG_EVENTS
printf("signalInputEvent\n");
#endif
if (inputEventSemaIndex > 0)
signalSemaphoreWithIndex(inputEventSemaIndex);
}
On win32 (platforms/win32/sqWin32Window.c)
There is a function which sets it up:
int ioSetInputSemaphore(int semaIndex) {
inputSemaphoreIndex = semaIndex;
return 1;
}
but there is no any code which signals it.
There's only a code which looks like:
if(inputSemaphoreIndex) {
recordMouseEvent(lastMessage, nrClicks);
break;
}
The fix is ultimately trivial, as you may guess:
sqInputEvent *sqNextEventPut(void) {
sqInputEvent *evt;
evt = eventBuffer + eventBufferPut;
eventBufferPut = (eventBufferPut + 1) % MAX_EVENT_BUFFER;
if (eventBufferGet == eventBufferPut) {
/* buffer overflow; drop the last event */
printf("WARNING: event buffer overflow\n");
eventBufferGet = (eventBufferGet + 1) % MAX_EVENT_BUFFER;
}
+++ if(inputSemaphoreIndex)
+++ signalSemaphoreWithIndex(inputEventSemaIndex);
return evt;
}
--
Best regards,
Igor Stasenko AKA sig.
More information about the Vm-dev
mailing list