Plasma GitLab Archive
Projects Blog Knowledge

This example demonstrates how to use Unixqueues together with
labltk applications.

To get the example running, you need the TCL queue extension,
i.e. you must have built -with-equeue-tcl.

Compile simply with "make". This creates the executable "filecopy".
Furthermore, you need an arbitrary file "a.old" which will be copied
by the program to "a.new". It should be rather large; otherwise
copying will not last long enough to see the effect. You can create
a test file by doing

	dd if=/dev/zero of=a.old count=10000

Start then "filecopy". You will see a window that counts the number
of bytes already copied. While the copy is in progress, the "Stop"
button of this window is still active, because the Tcl/Tk events 
are processed concurrently with the events of the copy procedure.
If you press the button, copying stops immediately.

The copy procedure is rather slow compared with the native "cp" command
of the operating system. The reason are the too frequent updates of
the "progress meter"; you may consider to introduce another timer into
the example which limits the update frequency to a reasonable value.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml