Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Andrew Brunner
Another problem may be that more often then not another thread may want to acquire a new object reference. What is the status of the cMem memory manager / with/without? Can one thread create an object and be freed by another thread? What about stacks? I know you can attach events to threads usi

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Andrew Brunner
> function TDLLItem.getNextItem():TDLLItem; > begin >  EnterCriticalSection(FOwner.FLock); >  Try >     Result:=FNext; >  Finally >    LeaveCriticalSection(FOwner.FLock); >  end; > end; Thread1 code ... itm=List.First; while itm<>nil do begin itm.Process; itm=item.Next; // good

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Andrew Brunner
2011/7/1 Hans-Peter Diettrich : > Adem schrieb: >> >> Why each and every object? I thought (b)locking only those touched in >> the Attach() procedure (9 nodes, in my ) would be sufficient; wouldn't it? Each and every element in the collection may prove difficult to protect for a general purposing.

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Hans-Peter Diettrich
Adem schrieb: On 2011-07-02 02:29, Andrew Brunner wrote: 2011/7/1 Adem: There is no thread-safe way to write to those variables safely without blocking access to each and every object in the entire collection as demonstrated. Why each and every object? I thought (b)locking only those touched i

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Adem
On 2011-07-02 02:29, Andrew Brunner wrote: 2011/7/1 Adem: There is no thread-safe way to write to those variables safely without blocking access to each and every object in the entire collection as demonstrated. Why each and every object? I thought (b)locking only those touched in the Attach()

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Andrew Brunner
2011/7/1 Adem : > In a multi-core multi-threaded platoform, I simply cannot see (other than > locking the whole object) how any amount of interlocking or critical > sections (or whatever) can guarantee that none of these 9 variables (nodes) > will not be altered/deleted while we're in Attach() proc

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Adem
On 2011-07-01 18:49, Hans-Peter Diettrich wrote: Such a beast would deserve many coding efforts, which are unlikely to be ever taken. It's much simpler to control existing references to an object, since every use of an object deserves an object reference. In a double-linked list (or a treeview

Re: Re[2]: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Jonas Maebe
Hello, This thread is now also moderated. See http://lists.freepascal.org/lists/fpc-other/2011-July/000637.html for the reason why. Please start/continue any discussions about how to safely program in a multithreaded way on the fpc-other list (unless it's about concrete proposals for language

Re: Re[2]: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Andrew Brunner
On Fri, Jul 1, 2011 at 12:48 PM, José Mejuto wrote: > This code will crash at a given time, maybe 1 millisecond, maybe 2 > days, but it will crash. Yes. It will fail. Access to a,b are forbidden without acquiring a lock. > Cache coherence is maintained by the hardware, interlocked only > provi

Re[2]: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread José Mejuto
Hello FPC, Friday, July 1, 2011, 6:44:44 PM, you wrote: HPD> This scenario was reflected in my example (bi-linked list update). HPD> The very last sentence deserves clarification. When not *all* HPD> assignments are protected by a CS, the use of Interlocked assignments HPD> only can improve cache

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Andrew Brunner
On Fri, Jul 1, 2011 at 11:44 AM, Hans-Peter Diettrich wrote: > IMO a linked list can not work flawlessly, until at least a > multiple-read-exclusive-write lock is used. While an exclusive-write lock > can ensure list consistency, every unsynchronized reader will be fooled by > concurrent changes

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Hans-Peter Diettrich
Adem schrieb: On 2011-06-30 17:07, Hans-Peter Diettrich wrote: The idea is a merge of reference counting and thread synchronization, which I could not find in any other language yet (dunno about ADA in detail), but which can be implemented easily in OPL/FPC. Inspiration came from TThreadList and

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Hans-Peter Diettrich
Vincent Snijders schrieb: Michael Schnell wrote: In another topic (now closed) Andrew described that a code similar to HansPeter's example did run correctly on a dual core machine, but produced errors on a machine with more cores. I've not been reading every message. Definitive URL? I cannot

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Hans-Peter Diettrich
Michael Schnell schrieb: Thinking about that for just a few minutes I have not been able to come up with a definition of where exactly the compiler is supposed to increment/decrement the thread-reference-count. Can you ? My intention was to just use *existing* refcounting procedures, whose f

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Andrew Brunner
On Fri, Jul 1, 2011 at 8:51 AM, Mark Morgan Lloyd wrote: > Fair play, he /has/ said he's mailed Andrew looking for source. I never received such email. But to Michael's defense, Google mail isn't the product it once was. > However under the circumstances we've got to have something definitive t

[fpc-devel] How to solve a checksum error

2011-07-01 Thread Felipe Monteiro de Carvalho
Hello, I am unable to build lazarus-ccr/applications/fpbrowser/fpbrowser.lpi in Windows =( With an error which seams almost the same as reported here: http://bugs.freepascal.org/view.php?id=15218 I searched everywhere about how to improve my configuration, but I simply cannot find anything to fi

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Mark Morgan Lloyd
Vincent Snijders wrote: 2011/7/1 Michael Schnell : On 07/01/2011 02:00 PM, Vincent Snijders wrote: I won't call that a definitive URL, but some vague indication. That is more than 200 mails at least. I'd expected you to give a link to the email in the archives where "Andrew described a code". S

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Adem
On 2011-06-30 17:07, Hans-Peter Diettrich wrote: The idea is a merge of reference counting and thread synchronization, which I could not find in any other language yet (dunno about ADA in detail), but which can be implemented easily in OPL/FPC. Inspiration came from TThreadList and Interfaces.

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Michael Schnell
On 07/01/2011 03:03 PM, Vincent Snijders wrote: So how you expect us to find the description *you* want us to read in all those mails, if even you cannot find it. I can't find it in the backlog website. I did find it in my mailstore (no idea if this helps, though): This is the message of An

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Vincent Snijders
2011/7/1 Michael Schnell : > On 07/01/2011 02:00 PM, Vincent Snijders wrote: >> >> I won't call that a definitive URL, but some vague indication. That is >> more than 200 mails at least. I'd expected you to give a link to the >> email in the archives where "Andrew described a code". >> So, which li

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Michael Schnell
On 07/01/2011 02:47 PM, Hans-Peter Diettrich wrote: Hmm, when the first reference is stored in a global variable, as was my intention, what happens to the refcount when a method is invoked immediately from that reference? While I do think that a "kind of reference counting" for locking/unlo

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Michael Schnell
On 07/01/2011 02:00 PM, Vincent Snijders wrote: I won't call that a definitive URL, but some vague indication. That is more than 200 mails at least. I'd expected you to give a link to the email in the archives where "Andrew described a code". So, which link to click on http://lists.freepascal.org

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Vincent Snijders
2011/7/1 Michael Schnell : > On 07/01/2011 11:26 AM, Mark Morgan Lloyd wrote: >> >> Michael Schnell wrote: >>> >>> In another topic (now closed) Andrew described that a code similar to >>> HansPeter's example did run correctly on a dual core machine, but produced >>> errors on a machine with more c

Re: [fpc-devel] MIPS

2011-07-01 Thread Mark Morgan Lloyd
Marc Weustink wrote: Mark Morgan Lloyd wrote: I hope to have an SGI machine in a few days, provided that it works (it's been stored in a garage) I might be able to look at mips as well as mipsel. If the SGI doesn't work, I;ll try to startup mine and give you remote access to it. (I got it in

Re: [fpc-devel] Safely shareable objects

2011-07-01 Thread Hans-Peter Diettrich
José Mejuto schrieb: IMyObject inherited from IShareable the compiler must add stub code on each function/procedure/property to lock the interface ? HPD> No. The object is locked as long the code holds the reference to it. In that case read my note at the end of the e-mail, I think it could n

[fpc-devel] Dynamic indexing (multi-dimensional-indexing) (probably my most important/valuable posting up to this date)

2011-07-01 Thread Skybuck Flying
This is probably the most important test/demonstration program I ever wrote and published/released onto the internet (up to this date (7 juli 2011)). I hope compiler writers/programming language designers will study it carefully and integrate it into their language. (It's a bit long/lengthy read

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Michael Schnell
On 07/01/2011 11:26 AM, Mark Morgan Lloyd wrote: Michael Schnell wrote: In another topic (now closed) Andrew described that a code similar to HansPeter's example did run correctly on a dual core machine, but produced errors on a machine with more cores. I've not been reading every message. De

Re: [fpc-devel] MIPS

2011-07-01 Thread Sven Barth
Am 30.06.2011 23:03, schrieb Mark Morgan Lloyd: Felipe Monteiro de Carvalho wrote: On Thu, Jun 30, 2011 at 7:05 PM, Mark Morgan Lloyd wrote: I think his is a loader issue- the binary needs to know what .so to pull in that later allows it to work out paths etc. ops, it seams that you are righ

Re: [fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Mark Morgan Lloyd
Michael Schnell wrote: In another topic (now closed) Andrew described that a code similar to HansPeter's example did run correctly on a dual core machine, but produced errors on a machine with more cores. I've not been reading every message. Definitive URL? OTOH if some synchronization ensure

[fpc-devel] Re: fpc build problems on some debian armel buildds

2011-07-01 Thread Hector Oron
Hi, 2011/7/1 Hector Oron : > I'll upload this > binaries at this time unless you state the contrary. Instead of this, I have given back (trigger a rebuild) the package, as it was only built once at the end of may. Second, if the error reproduces again try to add more diagnostics code around the

[fpc-devel] Re: fpc build problems on some debian armel buildds

2011-07-01 Thread Hector Oron
Hello, 2011/6/30 peter green : > Could some arm users try building fpc and reporting back if they can > reproduce the error and if so on what hardware? (note: you must build with > -B or you will run into an unrelated failure). If it fails for you can you > try running the failing command under s

Re: [fpc-devel] Re: fpc build problems on some debian armel buildds

2011-07-01 Thread Jonas Maebe
On 01 Jul 2011, at 02:02, peter green wrote: Jonas Maebe wrote: On 30 Jun 2011, at 19:04, peter green wrote: Mark Morgan Lloyd wrote: There were issues with some versions of FPC, related to more than a certain number of parameters (four?) being passed. Jonas wrote the following on the

[fpc-devel] SMP > 2 core Cache issue with Posix threads

2011-07-01 Thread Michael Schnell
In another topic (now closed) Andrew described that a code similar to HansPeter's example did run correctly on a dual core machine, but produced errors on a machine with more cores. Now I understand that threaded FPC user programs are supposed to be done in a Posix compliant way and FPC/RTL/LC

RE: [fpc-devel] MIPS

2011-07-01 Thread Pierre Free Pascal
> -Message d'origine- > De : fpc-devel-boun...@lists.freepascal.org [mailto:fpc-devel- > boun...@lists.freepascal.org] De la part de Mark Morgan Lloyd > Envoyé : vendredi 1 juillet 2011 08:21 > À : fpc-devel@lists.freepascal.org > Objet : Re: [fpc-devel] MIPS > > Pierre Free Pascal wrote