Re: [fpc-pascal] D-Bus. Non blocking listening for signals
On Sun, 2 Jan 2011, dib...@wp.pl wrote: Hi, Month ago I posted a bug (http://bugs.freepascal.org/view.php?id=18117) Admin give me solution and feedback, but this solution doesn't work well and i think he don't read my last comment. So, maybe someone have this same problem. There is good demo for d-bus rewrited line by line from official C example. It works fine, but this is console demo. This demo listen for signals in main loop. In GUI application, this example blocks user interface. I received a solution to use Application.OnIdle event for check for signal. It works, but not detect all signals. If host send 10 this same signals, my application detect only 4-6. This problem raise after upgrade d-bus interface from 0.92 to 1.2.16 two months ago. Previously, I could use timers and threads for listening signals. The admin (me) did see your comment but didn't find time yet to investigate the problem in great length :) However, it seems that Henry Vermaak gave you a solution. I am glad he did, because I have written a complete set of D-BUS components which I was about to publish, and they would suffer from the same problem when used in a GUI app. So now I know that I should create an integration with the Lazarus message loop. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] error compiling lazarus
On 01/02/11 20:17, Mark Morgan Lloyd wrote: > Mark Morgan Lloyd wrote: > >>> i compiled it with the svn version of fpc and of lazarus. >>> still the same error. >> >> I've been having problems on one particular machine over the last few >> days which I suspect are down to inadequate RAM+swap- I think I've >> only got around 512Mb total. > > This was on a SPARC/Linux system, it's not the same as the slow Solaris > compilation I've been ranting about. A system with around 512Mb RAM+swap > is having problems usually during linkage, while one with around 768Mb > RAM+swap is OK. > I don't think i have a RAM problem. I am running this on a Intel(R) Core(TM)2 Duo CPU T9900 @ 3.06GHz 8GB RAM ppcx64 i can reproduce the error with this little programm. The programm still prints the "test1" and "test2". And when he tryes to set the var Application it crashed in Line47. <<< test svn2revisioninc.pas >>> program Svn2RevisionInc; {$mode objfpc}{$H+} uses Classes, CustApp; type { TSvn2RevisionApplication } TSvn2RevisionApplication = class(TCustomApplication) private test : string; public constructor Create(TheOwner: TComponent); override; destructor Destroy; override; procedure Run; end; var Application: TSvn2RevisionApplication = nil; constructor TSvn2RevisionApplication.Create(TheOwner: TComponent); begin inherited Create(TheOwner); test := 'test1'; writeln(test); test := 'test2'; writeln(test); end; destructor TSvn2RevisionApplication.Destroy; begin inherited Destroy; end; procedure TSvn2RevisionApplication.Run; begin exit; end; begin Application := TSvn2RevisionApplication.Create(nil); Application.Run; Application.Free; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] D-Bus. Non blocking listening for signals
On 2 January 2011 21:23, wrote: >> I had a quick look at the dbus functions. Perhaps you can use >> dbus_connection_set_wakeup_main_function to set up a function that >> wakes up your main loop (containing something like: >> g_main_context_wakeup(g_main_context_default) for gtk+). This will >> fire the OnIdle event where you can read the message. >> >> Another solution can be to launch a thread that executes a loop of >> dbus reads. You can then communicate back to the main thread. >> >> Henry > > Wow, thanks! I read few examples in different programing languages, but > nowhere was no mention of this procedure. Although this example doesn't work > (or I am doing something wrong): > dbus_connection_set_wakeup_main_function(conn, @g_main_context_wakeup, > g_main_context_default, nil); No, I meant almost like you did below. > But I declared my own procedure where I call checking for signals: > > procedure TestTest(data: Pointer); cdecl; > begin > Form1.CheckForMessage; Here I would use Application.QueueAsyncCall to queue a method to check for messages, then g_main_context_wakeup(g_main_context_default), which is asynchronous, so you don't block your dbus callback. This may not be a problem. The way you've done it is probably OK! Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] D-Bus. Non blocking listening for signals
W dniu 02.01.2011 21:36, Henry Vermaak pisze: On 2 January 2011 19:42, wrote: You may already know this, but it may help to point out that the OnIdle event won't fire if there are no other events. For example, you'll have to move your mouse or hit the keyboard for the OnIdle event to be called. I don't know if this will affect talking to dbus (does it queue up the signals?). Henry Yes, but I noticed that when there are no events, OnIdle is fired even so (at 5 seconds cycle). I thought it was enough to catch signal, but maybe it's too long and signals may have short live. C example uses glib main loop to check signals. I see that free pascal have some glib librarys. Can I somehow use it (I do not know what it is)? I need this solution only for linux I had a quick look at the dbus functions. Perhaps you can use dbus_connection_set_wakeup_main_function to set up a function that wakes up your main loop (containing something like: g_main_context_wakeup(g_main_context_default) for gtk+). This will fire the OnIdle event where you can read the message. Another solution can be to launch a thread that executes a loop of dbus reads. You can then communicate back to the main thread. Henry Wow, thanks! I read few examples in different programing languages, but nowhere was no mention of this procedure. Although this example doesn't work (or I am doing something wrong): dbus_connection_set_wakeup_main_function(conn, @g_main_context_wakeup, g_main_context_default, nil); But I declared my own procedure where I call checking for signals: procedure TestTest(data: Pointer); cdecl; begin Form1.CheckForMessage; end; dbus_connection_set_wakeup_main_function(conn, @TestTest, nil, nil); And it works perfect! :) . Thanks again. BTW: About your suggestion to use threads. I used threads before and it worked very long on my application. But it stopped after upgrade d-bus interface. That is why I post this problem Regards. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] D-Bus. Non blocking listening for signals
On 2 January 2011 19:42, wrote: >> >> You may already know this, but it may help to point out that the >> OnIdle event won't fire if there are no other events. For example, >> you'll have to move your mouse or hit the keyboard for the OnIdle >> event to be called. I don't know if this will affect talking to dbus >> (does it queue up the signals?). >> >> Henry > > Yes, but I noticed that when there are no events, OnIdle is fired even so > (at 5 seconds cycle). I thought it was enough to catch signal, but maybe > it's too long and signals may have short live. C example uses glib main loop > to check signals. I see that free pascal have some glib librarys. Can I > somehow use it (I do not know what it is)? I need this solution only for > linux I had a quick look at the dbus functions. Perhaps you can use dbus_connection_set_wakeup_main_function to set up a function that wakes up your main loop (containing something like: g_main_context_wakeup(g_main_context_default) for gtk+). This will fire the OnIdle event where you can read the message. Another solution can be to launch a thread that executes a loop of dbus reads. You can then communicate back to the main thread. Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] D-Bus. Non blocking listening for signals
W dniu 02.01.2011 20:11, Henry Vermaak pisze: On 2 January 2011 18:49, wrote: Hi, Month ago I posted a bug (http://bugs.freepascal.org/view.php?id=18117) Admin give me solution and feedback, but this solution doesn't work well and i think he don't read my last comment. So, maybe someone have this same problem. There is good demo for d-bus rewrited line by line from official C example. It works fine, but this is console demo. This demo listen for signals in main loop. In GUI application, this example blocks user interface. I received a solution to use Application.OnIdle event for check for signal. It works, but not detect all signals. If host send 10 this same signals, my application detect only 4-6. This problem raise after upgrade d-bus interface from 0.92 to 1.2.16 two months ago. Previously, I could use timers and threads for listening signals. You may already know this, but it may help to point out that the OnIdle event won't fire if there are no other events. For example, you'll have to move your mouse or hit the keyboard for the OnIdle event to be called. I don't know if this will affect talking to dbus (does it queue up the signals?). Henry Yes, but I noticed that when there are no events, OnIdle is fired even so (at 5 seconds cycle). I thought it was enough to catch signal, but maybe it's too long and signals may have short live. C example uses glib main loop to check signals. I see that free pascal have some glib librarys. Can I somehow use it (I do not know what it is)? I need this solution only for linux ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] error compiling lazarus
Mark Morgan Lloyd wrote: i compiled it with the svn version of fpc and of lazarus. still the same error. I've been having problems on one particular machine over the last few days which I suspect are down to inadequate RAM+swap- I think I've only got around 512Mb total. This was on a SPARC/Linux system, it's not the same as the slow Solaris compilation I've been ranting about. A system with around 512Mb RAM+swap is having problems usually during linkage, while one with around 768Mb RAM+swap is OK. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] D-Bus. Non blocking listening for signals
On 2 January 2011 18:49, wrote: > Hi, > > Month ago I posted a bug (http://bugs.freepascal.org/view.php?id=18117) > Admin give me solution and feedback, but this solution doesn't work well and > i think he don't read my last comment. > So, maybe someone have this same problem. There is good demo for d-bus > rewrited line by line from official C example. It works fine, but this is > console demo. This demo listen for signals in main loop. In GUI application, > this example blocks user interface. I received a solution to use > Application.OnIdle event for check for signal. It works, but not detect all > signals. If host send 10 this same signals, my application detect only 4-6. > This problem raise after upgrade d-bus interface from 0.92 to 1.2.16 two > months ago. Previously, I could use timers and threads for listening > signals. You may already know this, but it may help to point out that the OnIdle event won't fire if there are no other events. For example, you'll have to move your mouse or hit the keyboard for the OnIdle event to be called. I don't know if this will affect talking to dbus (does it queue up the signals?). Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] error compiling lazarus
Benedikt Schindler wrote: On 01/02/11 17:09, Paul Ishenin wrote: 02.01.2011 22:57, Benedikt Schindler wrote: hello, when i try to compile lazarus i get following error: [compiler crash] has anyone an idea what this could be? If the compiler version is from older than today please try to update and rebuild the compiler. Best regards, Paul Ishenin i compiled it with the svn version of fpc and of lazarus. still the same error. I've been having problems on one particular machine over the last few days which I suspect are down to inadequate RAM+swap- I think I've only got around 512Mb total. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] D-Bus. Non blocking listening for signals
Hi, Month ago I posted a bug (http://bugs.freepascal.org/view.php?id=18117) Admin give me solution and feedback, but this solution doesn't work well and i think he don't read my last comment. So, maybe someone have this same problem. There is good demo for d-bus rewrited line by line from official C example. It works fine, but this is console demo. This demo listen for signals in main loop. In GUI application, this example blocks user interface. I received a solution to use Application.OnIdle event for check for signal. It works, but not detect all signals. If host send 10 this same signals, my application detect only 4-6. This problem raise after upgrade d-bus interface from 0.92 to 1.2.16 two months ago. Previously, I could use timers and threads for listening signals. Regard ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] error compiling lazarus
On 01/02/11 17:09, Paul Ishenin wrote: > 02.01.2011 22:57, Benedikt Schindler wrote: >> hello, >> >> when i try to compile lazarus i get following error: >> [compiler crash] >> >> has anyone an idea what this could be? > If the compiler version is from older than today please try to update > and rebuild the compiler. > > Best regards, > Paul Ishenin > i compiled it with the svn version of fpc and of lazarus. still the same error. best regards, Benedikt ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] error compiling lazarus
02.01.2011 22:57, Benedikt Schindler wrote: hello, when i try to compile lazarus i get following error: [compiler crash] has anyone an idea what this could be? If the compiler version is from older than today please try to update and rebuild the compiler. Best regards, Paul Ishenin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] error compiling lazarus
hello, when i try to compile lazarus i get following error: Free Pascal Compiler version 2.5.1 [2011/01/02] for x86_64 Copyright (c) 1993-2010 by Florian Klaempfl Note: Switching assembler to default source writing assembler Target OS: Linux for x86-64 Compiling lazcontrols.pas Compiling dividerbevel.pas Assembling dividerbevel Compiling extendednotebook.pas Assembling extendednotebook Assembling lazcontrols 688 lines compiled, 0.3 sec 4 hint(s) issued 1 note(s) issued /bin/cp -fp Makefile.compiled lib/x86_64-linux/LazControls.compiled make[2]: Leaving directory `/opt/lazarus/components/lazcontrols' make[1]: Leaving directory `/opt/lazarus/components' make -C ide ide make[1]: Entering directory `/opt/lazarus/ide' ../tools/svn2revisioninc .. revision.inc An unhandled exception occurred at $004935D1 : EAccessViolation : Access violation $004935D1 line 2087 of lclproc.pas $004A0189 line 4724 of lclproc.pas $0043ADB6 line 794 of ../inc/system.inc make[1]: *** [revisioninc] Error 217 make[1]: Leaving directory `/opt/lazarus/ide' make: *** [ide] Error 2 i get the same error when i try to start the tool by hand. linux-t613:/opt/lazarus/tools # ./svn2revisioninc An unhandled exception occurred at $004935D1 : EAccessViolation : Access violation $004935D1 line 2087 of lclproc.pas $004A0189 line 4724 of lclproc.pas $0043ADB6 line 794 of ../inc/system.inc has anyone an idea what this could be? greatings Benedikt ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal