Re: [NTLK] MadMax and >22kHz files, threading..

From: Paul Guyot (pguyot_at_kallisys.net)
Date: Tue Mar 19 2002 - 01:17:42 EST


Date: Mon, 18 Mar 2002 13:49:05 -0500
From: Jim Witte <jswitte_at_bloomington.in.us>

> Technical oddities: I noticed was that if I selected a word and kept
>it selected in one of the fields in MadMax, it interrupted the playback,
>but if i started to write a word, and just kept then pen held down at
>the end of a stroke, it didn't. Paul, any idea why the guesture would
>interrupt the Newtonscript thread but not the writing (Does the writing
>go directly to the inker thread and not get passed to the NS thread
>until it's finished?)

When you press the pen, the inker task records your sismogram and
consequently sends events to the NewtonScript task. Under some
conditions (like writing over some kind of views) it calls
viewClickScript or the C++ equivalent repeatedly. Consequently, it
calls much less often (read: it stops to call) deferred tasks. Hence
the fact that MadMax stopped.

>Also, what thread does C++ code run in?

C++ code runs in whatever *task* (in NewtonOS, the word is task,
"thread" is reserved for a big hack in the NewtonScript task).
AFAIK, MadMax decodes data in the NewtonScript task.

>Would it
>be possible to have it run preemptively with the NS thread, or to fork
>off the Mad Max player itself (or at least the code that stuffs the
>sound buffer) into a seperate NS thread?

(here, "NS thread" is the proper expression, but NS threads are "cooperative").
Yes, it is possible, but I think it will be equivalent to deferred
tasks regarding the problem you experienced (because it is
cooperative and the main thread won't yield to the mad max player).

The other way would be to have the decoder in a preemptive separated
task. The problem then (with all preemptive tasks in NewtonOS
actually) is that input data is only available from the NewtonScript
task (you cannot access the stores otherwise, although TCP/IP
streaming could avoid using the NS task) and output data has to be
fed from NewtonScript task (although it might be possible to feed the
sound output from any task, AFAIK it is not documented).

Paul

-- 
Home page: http://www.kallisys.com/
Newton-powered WebServer: http://newton.kallisys.net:8080/

-- Read the List FAQ/Etiquette: http://www.newtontalk.net/faq.html Read the Newton FAQ: http://www.guns-media.com/mirrors/newton/faq/ This is the NewtonTalk mailing list - http://www.newtontalk.net



This archive was generated by hypermail 2.1.2 : Tue Apr 02 2002 - 14:03:10 EST