Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Helmut Hartl
-Original message- From: Dariusz Mazur Sent: Fri 18-09-2009 16:24 To: FPC-Pascal users discussions ; Subject: Re: [fpc-pascal] getting started with threads > David Emerson pisze: > > I am getting started with threads (linux/cthreads) and I'm very happy so > > far, but unsure of the best

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 23:04, Dariusz Mazur wrote: But is this optimal solution: procedure SysThreadSwitch; begin Sleep(0); end; WinThreadManager.ThreadSwitch :=...@systhreadswitch; procedure ThreadSwitch; begin CurrentTM.ThreadSwitch; end; We have 2 unnecessary invoke functio

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Dariusz Mazur
Jonas Maebe pisze: On 18 Sep 2009, at 21:30, Dariusz Mazur wrote: On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 21:30, Dariusz Mazur wrote: On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86 machines

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Dariusz Mazur
Jonas Maebe pisze: On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86 machines, because it's missing memory

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Florian Klaempfl
Jonas Maebe schrieb: > > On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: > >> I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to >> distribute task between threads >> its much faster and well scaling on multicore. > > Note that it won't work as is on non-x86 machines, because it's

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 16:24, Dariusz Mazur wrote: I use own lockfree FIFO http://www.emadar.com/fpc/lockfree.htm to distribute task between threads its much faster and well scaling on multicore. Note that it won't work as is on non-x86 machines, because it's missing memory barriers (and I th

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Dariusz Mazur
David Emerson pisze: I am getting started with threads (linux/cthreads) and I'm very happy so far, but unsure of the best way to tackle my situation. I have a program that needs to perform about 10,000 independent tasks, which usually involve waiting for I/O; thus it makes sense to use severa

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Graeme Geldenhuys
Florian Klaempfl het geskryf: > > Hope you find a good cross platform solution :) So far I have single interface for create/destroy/lock/unlock of semaphores for Windows, Linux, *BSD. The latter two is actually for all unix with posix systems. So no more IFDEF's and specific uses clauses units in

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 12:12, Martin wrote: Should semaphores be on the thread manager? because imho they are not realy thread related? They can be used by threads, but they have lot's of other uses. Even communication between processes of different applications. They are usually grouped tog

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Martin
just a question: Should semaphores be on the thread manager? because imho they are not realy thread related? They can be used by threads, but they have lot's of other uses. Even communication between processes of different applications. They are usually grouped together with other IPC like ms

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 11:42, Graeme Geldenhuys wrote: Jonas Maebe het geskryf: I guess you mean that there aren't any :) True and False. :) It was recommended to me that I use the methods directly from the thread manager, then later it was not recommended. It's because there is no cross-pla

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > Jonas Maebe het geskryf: >> I guess you mean that there aren't any :) > > True and False. :) It was recommended to me that I use the methods > directly from the thread manager, then later it was not recommended. > Plus the methods available from the thread manager doe

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Graeme Geldenhuys
Jonas Maebe het geskryf: > > I guess you mean that there aren't any :) True and False. :) It was recommended to me that I use the methods directly from the thread manager, then later it was not recommended. Plus the methods available from the thread manager doesn't support initial max values for

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Jonas Maebe
On 18 Sep 2009, at 10:12, Graeme Geldenhuys wrote: And I'm working on cross-platform semaphore classes / methods because the current ones in FPC are totally useless. I guess you mean that there aren't any :) Jonas ___ fpc-pascal maillist - fpc-p

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Graeme Geldenhuys
Luca Olivetti het geskryf: > > There are some cross-platform synchronization classes in syncobjs > > http://www.freepascal.org/docs-html/fcl/syncobjs/index.html And I'm working on cross-platform semaphore classes / methods because the current ones in FPC are totally useless. Regards, - Graem

Re: [fpc-pascal] getting started with threads

2009-09-18 Thread Vincent Snijders
David Emerson schreef: I am getting started with threads (linux/cthreads) and I'm very happy so far, but unsure of the best way to tackle my situation. I have a program that needs to perform about 10,000 independent tasks, which usually involve waiting for I/O; thus it makes sense to use seve

Re: [fpc-pascal] Re: getting started with threads

2009-09-18 Thread Luca Olivetti
En/na Tobias Giesen ha escrit: Also possible but not easier. Threads should not be started or stopped for each task, instead they should wait for an event telling them to continue with the next task. For example using SetEvent / ResetEvent as well as: {$ifdef win32} WaitForSingleObject(Contin