Re: [lazarus] Multithreading in Lazarus = SMP Enabled applications?
En/na Michael Van Canneyt ha escrit: Second, If a thread wants to interact with the main thread, it calls 'Synchronize'. The main thread calls checksynchronize at regular intervals. This is transparant for you. Back in august for this to work the lcl had to be compiled with the -dUSE_SYNCHRONIZE option (which wasn't the default). (the relevant message from Micha is missing both at gmane and lazarus.freepascal.org). Is this the default now? 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] Multithreading in Lazarus = SMP Enabled applications?
Horacio Jamilis wrote: I wrote on the lazarus wiki about multithreaded applications at: http://wiki.lazarus.freepascal.org/index.php/Multithreaded_Application_Tutorial Feel free to add more info to it. Thanks. I corrected some of the grammar and spelling. Micha _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Multithreading in Lazarus = SMP Enabled applications?
Luca Olivetti wrote: En/na Michael Van Canneyt ha escrit: Second, If a thread wants to interact with the main thread, it calls 'Synchronize'. The main thread calls checksynchronize at regular intervals. This is transparant for you. Back in august for this to work the lcl had to be compiled with the -dUSE_SYNCHRONIZE option (which wasn't the default). (the relevant message from Micha is missing both at gmane and lazarus.freepascal.org). Is this the default now? Yes, since a couple of days, but not yet for lazarus 0.9.10. This was never necessary for win32, so for windows there is no need to recompile. Vincent. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Multithreading in Lazarus = SMP Enabled applications?
Luca Olivetti wrote: Back in august for this to work the lcl had to be compiled with the -dUSE_SYNCHRONIZE option (which wasn't the default). (the relevant message from Micha is missing both at gmane and lazarus.freepascal.org). Is this the default now? That requirement was removed last weekend by Vincent. After some evaluation it turned out enabling it had no harmful side effects anyway. Micha _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Multithreading in Lazarus = SMP Enabled applications?
On 11/5/05, Michael Van Canneyt [EMAIL PROTECTED] wrote: On linux, be sure to include the 'cthreads' as the first unit in your program's uses clause if you want to use threads. This will install the C thread manager. Note that X is NOT multithreaded, so you must synchronize all output with the main thread. i'm a little curious, so i wanted to follow up. as i'm sure most of us know, threading is really not about whether you can spin a thread or not. the hard work in threading is of course to make sure that your own code, and more importantly, all of the runtime code your are linking with is thread safe. so Michael, your comment about X is meant to convey the fact that the UI subsystem on Linux, namely X and all of the subsystems in contains, are not thread safe ? are all _other_ units in the FPC and Lazarus runtime known to be thread safe (barring bugs of course) ? presumably there can be other gotchas with non-thread safe libs ? i assume the 'c' runtime on linux is pretty safe these days. i don't know whether all linux distros compile code with multi threaded flags ? i use Gentoo, and i think there are packages sometimes that require you to specify multi threaded flags, it isn't the default. are there any references on threading/cross platform mechanisms for writing portable, threaded code ? for instance, in Java, there are mechanisms for interacting with the UI event dispatching thread, so that you can update/interact with widgets in a thread safe fashion, which is i assume what you were talking about with X and coordinating. are these mutexes/guards going to be platform specific ? i don't have too much experience with MT on Linux, so i was curious if there were more thoughts on the subject. Michael. Tony _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Multithreading in Lazarus = SMP Enabled applications?
On Sun, 6 Nov 2005, Tony Pelton wrote: On 11/5/05, Michael Van Canneyt [EMAIL PROTECTED] wrote: On linux, be sure to include the 'cthreads' as the first unit in your program's uses clause if you want to use threads. This will install the C thread manager. Note that X is NOT multithreaded, so you must synchronize all output with the main thread. i'm a little curious, so i wanted to follow up. as i'm sure most of us know, threading is really not about whether you can spin a thread or not. the hard work in threading is of course to make sure that your own code, and more importantly, all of the runtime code your are linking with is thread safe. so Michael, your comment about X is meant to convey the fact that the UI subsystem on Linux, namely X and all of the subsystems in contains, are not thread safe ? Yes. Only 1 thread can access X. The same is true in Windows, BTW. are all _other_ units in the FPC and Lazarus runtime known to be thread safe (barring bugs of course) ? The system unit is threadsafe, and so is classes/sysutils. You'll have to check this on a unit by unit basis. presumably there can be other gotchas with non-thread safe libs ? Yes. i assume the 'c' runtime on linux is pretty safe these days. i don't know whether all linux distros compile code with multi threaded flags ? If libc is thread-safe, there should be no need. i use Gentoo, and i think there are packages sometimes that require you to specify multi threaded flags, it isn't the default. are there any references on threading/cross platform mechanisms for writing portable, threaded code ? No. for instance, in Java, there are mechanisms for interacting with the UI event dispatching thread, so that you can update/interact with widgets in a thread safe fashion, which is i assume what you were talking about with X and coordinating. Yes. are these mutexes/guards going to be platform specific ? No. First, FPC offers a cross-platform thread API. Second, If a thread wants to interact with the main thread, it calls 'Synchronize'. The main thread calls checksynchronize at regular intervals. This is transparant for you. When writing threads in GUI programs, simply make sure that all screen input/output is always done in the main thread. That is why you have synchronize: to notify the main thread that there is something to display. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] Multithreading in Lazarus = SMP Enabled applications?
Hi, I was trying to look for information about how to enable a linux server application to work with any procesor available on the system, being, this way, SMP enabled. Someplace I readed that working in Delphi with the TThread class (this is the way I work), the applications will be SMP automagically on Windows. Is this true? Happens the same with FPC/Lazarus? On windows? On linux? Thanks Horacio Jamilis
Re: [lazarus] Multithreading in Lazarus = SMP Enabled applications?
On Sat, 5 Nov 2005, Horacio Jamilis wrote: Hi, I was trying to look for information about how to enable a linux server application to work with any procesor available on the system, being, this way, SMP enabled. Someplace I readed that working in Delphi with the TThread class (this is the way I work), the applications will be SMP automagically on Windows. Is this true? Yes. Happens the same with FPC/Lazarus? On windows? On linux? Yes. On linux, be sure to include the 'cthreads' as the first unit in your program's uses clause if you want to use threads. This will install the C thread manager. Note that X is NOT multithreaded, so you must synchronize all output with the main thread. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives