To summarize the bit above:

-- If you pass non-preemptive code to a pre-emptive worker, it won't work.

-- That's not a bug, that's a limitation.

-- 4D doesn't automatically handle this situation well, but they've said
that they'll make ON ERR CALL work, which seems like a reasonable response.

-- The Compiler should check methods passed to workers. Maybe it will,
maybe it won't. I think that it should (obviously), but I don't get to
decide.

-- For now, what you need to do is remember to *manually* check code passed
to the second parameter of CALL WORKER. It's on us.

-- The easiest way that I've found to take this step is as follows:

* Create a method marked to run in preemptive mode. You don't run it, it's
just a place to expose code to the compiler.

* Use Find in Design to locate all CALL WORKER calls.

* Copy and paste in whatever methods you pass in the second parameter.
These are what get run through EXECUTE by the worker, once received.

* Use the compiler to check syntax.

Now you should see errors on the methods that are going to fail. A bonus
from doing things this way is that you get an error the *specific* methods
that are causing trouble. For those that don't know, when you compile 4D
scans the visible call tree for each method that _might_ be called from
within a preemptive process. However, it only reports specific errors at
the top level. It's pretty frustrating trying to figure out what the
problem is (don't forget triggers). The docs say that this is the way the
Compiler works, so it's not technically a bug (unexpected behavior.) It is,
however, a giant, time-sucking hole that makes getting code into preemptive
mode harder than it needs to be. Seems like a good feature request - the
compiler gathers the necessary information during its scan and then throws
it away and gives us a report that says "Something seems not okay?"

Anyway, that's the state of the art today.

P.S. Because of the silent failures in preemptive mode, your code may not
be executing at all. Or some of it might not be. Orit might be causing
problems. There's just no way to know without looking very, very carefully.
It's early days for preemptive mode, so I'd suggest you consider any work
with it experimental.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to