[Lazarus] fpWeb long process progress

Marcos Douglas md at delfire.net
Tue Aug 14 03:17:18 CEST 2012


On Mon, Aug 13, 2012 at 7:31 PM, Leonardo M. Ramé <l.rame at griensu.com> wrote:
>
> On 2012-08-13 15:15:56 -0700, leledumbo wrote:
> > > How can I send responses by intervals?
> >
> > AFAIK that's not the way web application works. It's the client that
> > should
> > be querying the server in a regular interval (using AJAX request
> > perhaps).
> > The server can track current progress status and return that right away
> > when
> > asked.
> >
>
> Yes, I know that, but I thought Lazarus have something easy to develop
> such process.
>
> The way I'm thinking of implementing is this:
>
> 1) The client app asks the server (a CGI process) for a process ID, for
> example 123, by calling getProcId.
> 2) Using this ID, the client calls the time-consuming task, passing the
> ID. for example, runTask(Id). At this time, the server launches a
> program passing the ID for the task. This must be a multi-thread
> program, because it can be asked for running many tasks, and can be
> asked for the status of each task. The program only finishes when the
> last task is ended.
> 3) The client calss a getProcStatus(ID) method. The server, using IPC or
> Pipes, asks the already-launched process for its status.

Your program is the main thread. For each request your program should
create a new thread to process. Each thread synchronizes with the main
thread (your program) about it your own status.

Already exists an example with the same idea (more or less)... in
Pascal... called ExtPascal.

Marcos Douglas




More information about the Lazarus mailing list