[Lazarus] Threads and Libraries (dll and so)

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Feb 7 03:57:43 CET 2014


Mark Morgan Lloyd schrieb:

> I think that the only thing remotely worth pursuing, bearing in mind the 
> current state of widget sets etc., would be whether an LCL in a dll/so 
> animated by its own thread (which MichaelS has already said was doable) 
> could output to a buffer, which could then be copied in a thread-safe 
> fashion to the main form. I speculate that even if that was doable, 
> getting UI events into the background LCL would be difficult, which in 
> practice would severely curtail the components which could be used.

That's exactly how it should be done. Threads fill their video buffer, 
then send a message to the GUI thread, to copy the frame into the output 
buffer and request an screen refresh. That's a total of 3 messages per 
stream and frame.

Eventually the video threads can write directly into the output buffer, 
eliminating one copy action. Then the GUI thread can switch between 
multiple buffers, one to be filled and the other one ready for display.

DoDi





More information about the Lazarus mailing list