RE: updating dialogs

From: [at]} <support{>
Date: Sat, 22 May 2004 10:54:14 +0200

----boundary-LibPST-iamunique-1035438310_-_-
Content-type: text/plain

Fyodor,

we had a look at your small example program (not sent to the mailing list).
Basically the snippet amounts to

  start := Services.Ticks();
  FOR n := 1 TO 10 DO
    ...
    REPEAT
      x := Math.Sqrt( n )
    UNTIL Services.Ticks() > start + n * Services.resolution;
    ...
  END

As it turns out, your command sits indeed for about 10 seconds in a loop
without letting BlackBox 'breath' in its own main loop.

There are two solutions for this.

(1.) Cooperative multitasking: Chop your program into really small chunks
and use Services.Actions. Please refer to ObxActions for an example.

(2.) Use Werner Braun's "Multithreading with Processes" pattern. I've
attached below excerpts from Werner's emails dated 20th February 2003
explaining his solution. As a side note: Try adding the command line
parameter "/EMBEDDING" to your slave BlackBox process. This way, your
communication engine will not open its main window.

Cheers
Marc
Oberon microsystems, Inc.




From: Werner Braun [wb{([at]})nowhere.xy
Sent: Donnerstag, 20. Februar 2003 08:48
To: blackbox{([at]})nowhere.xy
Subject: Re: Multithreading

There is another way to provide "Multi-Tasking" with BlackBox.

(1.) BlackBox.exe accepts command-line Parameters. Open a Shell, change to
the BlackBox directory and enter: BlackBox.exe /par "my parameter list".
Within the called BlackBox instance you can access the parameters by the
variable Dialog.commandLinePars

(2.) You can start any external program from within BlackBox using
HostDialog.Start.

Now implement this:

Master-Process
=======
Call slave-process HostDialog.Start("BlackBox /par 'my parameters or
param-file' "). Use a Services.Action for polling if the file
"Slave-running.empty" still exists. After the file is gone, read in the data
out of the param-file or any other data-file.

Slave-Process
======Modify module Config to check if some parameters have been passed. Create
file "Slave-running.empty". Read in parameter list or file. Do (blocking)
stuff, write data-file. Delete file "Slave-running.empty". Exit using
Kernel.Quit(0) (which prevents opening Pop-Up-Boxes).

The several BlackBox instances can also communicate over TCP/IP using the
module CommTCP. That's what our Web-Application-Server can do. One

Master-process (server) uses several Slave-Processes (workers) and they
communicate using CommTCP.

You can simply send data around using Stores.Writers. Write the data to a
file. Copy the file via a TCP/IP stream. Read the data from the resulting
file using Strores Readers. ... And voila you have "poor man's CORBA".

Besides some drawbacks (performance) there is one big advantage using TCP/IP
instead of threads: The co-operating processes can run on different machines
if you like.

Werner Braun


--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.



----boundary-LibPST-iamunique-1035438310_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEZ5b2RvcixccGFyDQpccGFyDQp3ZSBoYWQgYSBs
b29rIGF0IHlvdXIgc21hbGwgZXhhbXBsZSBwcm9ncmFtIChub3Qgc2VudCB0byB0aGUgbWFpbGlu
ZyBsaXN0KS5ccGFyDQpCYXNpY2FsbHkgdGhlIHNuaXBwZXQgYW1vdW50cyB0b1xwYXINClxwYXIN
CiAgc3RhcnQgOj0gU2VydmljZXMuVGlja3MoK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ZGVsYXksIGluIHBhcnRpY3VsYXIgb3ZlciB3ZWVr
ZW5kcyBvciBob2x5ZGF5cy5ccGFyDQpccGFyDQp9


----boundary-LibPST-iamunique-1035438310_-_---
Received on Sat May 22 2004 - 10:54:14 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:44 UTC