Re: [lazarus] Thread Behavior in Lazarus
On Monday 13 March 2006 11:25, Ales Katona wrote: > You cannot expect some magical stuff to be put into some invisible event > loop with console apps. > With GUI apps you don't control/design the event loop, you "hook" into > it. This means LCL can > CheckSynchronize() for you. Understood, but the application is an LCL GUI, the source is here if you want a look: http://www.proceduralminds.com/Files/LazThreads.tar.gz > > There's simply NO way FPC could magicly do this for you, it would have > to read your mind. > > Ales > > _ > To unsubscribe: mail [EMAIL PROTECTED] with > "unsubscribe" as the Subject >archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
You cannot expect some magical stuff to be put into some invisible event loop with console apps. With GUI apps you don't control/design the event loop, you "hook" into it. This means LCL can CheckSynchronize() for you. There's simply NO way FPC could magicly do this for you, it would have to read your mind. Ales _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
Paul Michell wrote: http://www.lazarus.freepascal.org/list_archives/lazarus/msg10481.html http://www.lazarus.freepascal.org/list_archives/lazarus/msg10483.html I couldn't find any reference to USE_SYNCHRONIZE referred to in these messages in the SVN lcl code I downloaded last week. Has the design changed since then? I do agree with Luca that this behavior should be automatic so that applications require less platform specific code. I think two things are being confused: for console applications that do not use the LCL for their main loop, they need to call CheckSynchronize themselves. However, when the LCL main loop is used, then things "just work". USE_SYNCHRONIZE has been enabled by default (and removed) some time ago. Micha _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
On Monday 13 March 2006 08:07, Luca Olivetti wrote: > En/na Paul Michell ha escrit: > >> If you use synchronize, the IDE calls "CheckSynchronize" for you. In > >> command line you need to do this in main thread. > > > > I tried this in the application OnIdle event with Done set to false and > > it worked a charm! I am a little concerned this may not be the best way > > to get this call seen by the main application loop. Any ideas? Once I > > have decided on the best way to handle this I will post a link to the > > revised code. > > IMHO this should work "automagically", no matter if inside the IDE or not. > In fact I though this was already so, but since I hadn't time to play > with lazarus lately I couldn't check: > > http://www.lazarus.freepascal.org/list_archives/lazarus/msg10481.html > http://www.lazarus.freepascal.org/list_archives/lazarus/msg10483.html > > Bye I couldn't find any reference to USE_SYNCHRONIZE referred to in these messages in the SVN lcl code I downloaded last week. Has the design changed since then? I do agree with Luca that this behavior should be automatic so that applications require less platform specific code. _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
En/na Paul Michell ha escrit: If you use synchronize, the IDE calls "CheckSynchronize" for you. In command line you need to do this in main thread. I tried this in the application OnIdle event with Done set to false and it worked a charm! I am a little concerned this may not be the best way to get this call seen by the main application loop. Any ideas? Once I have decided on the best way to handle this I will post a link to the revised code. IMHO this should work "automagically", no matter if inside the IDE or not. In fact I though this was already so, but since I hadn't time to play with lazarus lately I couldn't check: http://www.lazarus.freepascal.org/list_archives/lazarus/msg10481.html http://www.lazarus.freepascal.org/list_archives/lazarus/msg10483.html Bye -- Luca Olivetti Wetron Automatización S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007 _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
On Friday 10 March 2006 14:24, Ales Katona wrote: > "Why would the behaviour change from running from the IDE to > executing from the command line?" > > If you use synchronize, the IDE calls "CheckSynchronize" for you. In > command line you need to do this in main thread. I tried this in the application OnIdle event with Done set to false and it worked a charm! I am a little concerned this may not be the best way to get this call seen by the main application loop. Any ideas? Once I have decided on the best way to handle this I will post a link to the revised code. Thanks again, Paul > > _ > To unsubscribe: mail [EMAIL PROTECTED] with > "unsubscribe" as the Subject >archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
Am Freitag, den 10.03.2006, 13:52 + schrieb Paul Michell: > I have been looking at threads in FPC/Lazarus over the last few weeks and I > found on the web a conversion of the old Delphi threads demo that was > partially working. I have added the "{$ifndef win32} CThreads, {$endif}" > code to enable thread linking on Linux. I have also got the Synchronize calls > to work by adding the '@' operator to the DoVisualSwap procedure reference. I > also had to remove the final refresh of the paint boxes as this caused a seg > fault on Windows. The new version of the code is now here: > > http://www.proceduralminds.com/Files/LazThreads.tar.gz Only for the records (and because it was fun ;): It runs well and perfectly threaded on FreeBSD 4.11 with fpc 2.0.2 and Lazarus 0.9.13 beta (svn from yesterday). Thank you for letting me see this demo again, Marc _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
On Fri, 10 Mar 2006, Paul Michell wrote: On Friday 10 March 2006 14:02, Michael Van Canneyt wrote: On Fri, 10 Mar 2006, Paul Michell wrote: I have been looking at threads in FPC/Lazarus over the last few weeks and I found on the web a conversion of the old Delphi threads demo that was partially working. I have added the "{$ifndef win32} CThreads, {$endif}" code to enable thread linking on Linux. I have also got the Synchronize calls to work by adding the '@' operator to the DoVisualSwap procedure reference. I also had to remove the final refresh of the paint boxes as this caused a seg fault on Windows. The new version of the code is now here: http://www.proceduralminds.com/Files/LazThreads.tar.gz The threads now work fine on Windows and on Linux in the Lazarus IDE, unfortunately the Linux standalone program executes the threads sequentially, i.e. not using time slicing? I am testing in Laz 0.9.13Beta 9-2-06. Anyone any ideas? How the threads are executed is not up to FPC: the PThreads implementation is used to do the actual thread handling. The FPC code does not decide anything about how the threads are executed. Thanks for the reply. Why would the behaviour change from running from the IDE to executing from the command line? The IDE uses probably different libraries than your command-line program. CMem for instance. Is your program a GUI program or not, and so on... There are many factors involved... Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
"Why would the behaviour change from running from the IDE to executing from the command line?" If you use synchronize, the IDE calls "CheckSynchronize" for you. In command line you need to do this in main thread. _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
On Friday 10 March 2006 14:02, Michael Van Canneyt wrote: > On Fri, 10 Mar 2006, Paul Michell wrote: > > I have been looking at threads in FPC/Lazarus over the last few weeks and > > I found on the web a conversion of the old Delphi threads demo that was > > partially working. I have added the "{$ifndef win32} CThreads, {$endif}" > > code to enable thread linking on Linux. I have also got the Synchronize > > calls to work by adding the '@' operator to the DoVisualSwap procedure > > reference. I also had to remove the final refresh of the paint boxes as > > this caused a seg fault on Windows. The new version of the code is now > > here: > > > > http://www.proceduralminds.com/Files/LazThreads.tar.gz > > > > The threads now work fine on Windows and on Linux in the Lazarus IDE, > > unfortunately the Linux standalone program executes the threads > > sequentially, i.e. not using time slicing? I am testing in Laz 0.9.13Beta > > 9-2-06. Anyone any ideas? > > How the threads are executed is not up to FPC: the PThreads > implementation is used to do the actual thread handling. > > The FPC code does not decide anything about how the threads are > executed. > Thanks for the reply. Why would the behaviour change from running from the IDE to executing from the command line? > Michael. > > _ > To unsubscribe: mail [EMAIL PROTECTED] with > "unsubscribe" as the Subject >archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Thread Behavior in Lazarus
On Fri, 10 Mar 2006, Paul Michell wrote: I have been looking at threads in FPC/Lazarus over the last few weeks and I found on the web a conversion of the old Delphi threads demo that was partially working. I have added the "{$ifndef win32} CThreads, {$endif}" code to enable thread linking on Linux. I have also got the Synchronize calls to work by adding the '@' operator to the DoVisualSwap procedure reference. I also had to remove the final refresh of the paint boxes as this caused a seg fault on Windows. The new version of the code is now here: http://www.proceduralminds.com/Files/LazThreads.tar.gz The threads now work fine on Windows and on Linux in the Lazarus IDE, unfortunately the Linux standalone program executes the threads sequentially, i.e. not using time slicing? I am testing in Laz 0.9.13Beta 9-2-06. Anyone any ideas? How the threads are executed is not up to FPC: the PThreads implementation is used to do the actual thread handling. The FPC code does not decide anything about how the threads are executed. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] Thread Behavior in Lazarus
I have been looking at threads in FPC/Lazarus over the last few weeks and I found on the web a conversion of the old Delphi threads demo that was partially working. I have added the "{$ifndef win32} CThreads, {$endif}" code to enable thread linking on Linux. I have also got the Synchronize calls to work by adding the '@' operator to the DoVisualSwap procedure reference. I also had to remove the final refresh of the paint boxes as this caused a seg fault on Windows. The new version of the code is now here: http://www.proceduralminds.com/Files/LazThreads.tar.gz The threads now work fine on Windows and on Linux in the Lazarus IDE, unfortunately the Linux standalone program executes the threads sequentially, i.e. not using time slicing? I am testing in Laz 0.9.13Beta 9-2-06. Anyone any ideas? I would value any insight into what is going on as I need to use threads in my MSc dissertation project to be completed this September and I would very much like to use Lazarus as the development platform. Thanks, Paul _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives