On Sat, 26 Nov 2011 11:14:48 +0100 Hans-Peter Diettrich <[email protected]> wrote:
> Mattias Gaertner schrieb: > > On Fri, 25 Nov 2011 22:57:34 +0100 > > Hans-Peter Diettrich <[email protected]> wrote: > > > >> zeljko schrieb: > >>> On Friday 25 of November 2011 14:33:16 Hans-Peter Diettrich wrote: > >>> > >>> > >>> > And how does PostMessage fit into the picture? > >>> > >>> > >>> I'm using PostMessage in an audio application to update position of > >>> trackbar on mainform from another thread where audio file is loaded and > >>> playing and it works ok (tested qt and gtk2) > >> This looks like PostMessage is thread-safe, but is not a proof. > > > > Yes, PostMessage is thread safe. > > Thanks. > > > The PostMessage function places (posts) a message in the message queue > > and then returns without waiting. > > What again raises the question, how many message queues are supported by > the LCL, and what's required to use them. IMO, when the documentation uses the term "LCL" it should mean the the library as whole or the platform independent part. The "LCL interface" or "LCL widget set" is the glue between the LCL and the widget set. The "LCL" has only one event queue, running in the main thread. There are some specials in each widget set and/or LCL interface. But these are implementation details, which can change any time. > Until now I suppose that the > LCL has no platform-independent model for thread message queues, and > offers TApplication.QueueAsyncCall instead for cross-platform > applications. Right? Yes. > >> I just wonder how a broadcast (to HWND_BROADCAST) works with > >> SendMessage. But this is a feature that must not be supported for > >> non-Windows platforms. > > > > Do you mean "need not"? > > Perhaps I meant "must not necessarily...". Then yes. > Englisch Sprak schwere Sprak ;-) > > > >>> Qt have similar mechanism: SendEvent() & PostEvent() and it works in > >>> same way. > >> Are threads supported? > >> > >> > >> The more I try to understand the Lazarus message handling, the more > >> questions arise :-( > > > > QT functions are beyond the LCL docs. > > Right, but the docs should be valid for *all* platforms. QT functions are not valid for all LCL platforms. > This requires > to mention cross-platform issues (restrictions...), which affect > portable applications. What's a method worth, like > TWidgetset.SystemParameters, when it is only supported on Windows? > > It would be nice to get "not implemented" errors or at least "platform > specific" hints at *compile* time, not only when an application runs on > a customer's machine. Yes, that would be nice. But many functions are not called directly by the application or are compiled in, but never used. Maybe a "whole program optimization" compile can show which platform dependent functions are used. But even this will show too many functions, e.g. functions that are only called on special combinations of parameters. Are the new modifiers (platform, unimplemented, experimental) in fpc 2.4.2? > > The LCL does not support creating windows from other threads. > > You can try doing that by calling the appropriate widget set functions > > yourselves. But I don't know if that will work. > > So, your question is somewhat theoretical, isn't it? > > IMO the documentation of the TWidgetset base class is an essential part > of the Lazarus documentation. It is not only required to understand the > high-level LCL code, but also is a good place for the documentation of > the named constants, usable as parameters in many methods across the > entire LCL. Simply write, that the LCL is single threaded with a few exceptions. Create windows and controls only with the main thread. The LCL functions do not check if they are called by the main thread. Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
