OK. Not a line of code. Just a question.

Building an application with sockets similar to this several years ago, I
had to code a way I don't like. And I was wondering how some of you might
have handled it.

Since J is non-preemptive and must become idle to process interrupts,
Writing code to schedule pieces of the problem to other instances of J, then
wait for their completion, is not very pretty. The function that schedules
the work and any functions that called it must end so J goes idle. Then, as
interrupts come in, a different function, the handler for the interrupts,
must pick up, check for all scheduled instances of J have completed, then
continue with the problem. If we are using sockets to communicate, then this
second function must be socket_handler run in the base locale. I used this
approach several years ago and it works fine, but my background in
structured programming makes me uncomfortable with it. It's just ugly!

This could be simplified by using blocking sockets. When all work is
scheduled simply do a sdrecv. Since the socket is blocking, it will hang
until data is received. Fine, unless we need to watch for interrupts from
several sockets. So it's back to using socket_handler.

Thoughts?


On Tue, Feb 16, 2010 at 3:05 PM, <[email protected]> wrote:

> >I think it would be best to keep the discussion public, because the more
> >eyes the better. [...] Does anyone object?
>
> For "chat", anything goes (and I don't give a damn).
>
> I *do* object to messages submited to "programming" with lots of
> geral statements, handwaving, but not a single line of specific J
> _program_ and its possible vectorised/parallised implementation.
>
> Since my nerves are already worn thin by the "Annoted Dictionary"
> mega thread "over there", here a small reminder how the "programming"
> forum is defined [on http://jsoftware.com/forums.htm]:
>
>        "programming - the main forum, covering J programming from
>        beginner to expert, and announcements"
>
> Repeat:  "covering J programming".
>
> That is NOT:  "covering the didactics of J programming".
> That is NOT:  "covering implementations of J".
>
> While the latter are certainly worthwile topics, they are just
> off-topic noise in "programming".
>
>                                                        Martin
>
> This message typed on a device with limited tolerances.
> Excuse any overly harsh expressions.
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to