Re: [fpc-pascal] Threadvar member field

2017-03-21 Thread Michael Schnell
On 17.03.2017 23:51, African Wild Dog wrote: I will have to redesign my classes =(. Maybe you just can add a field denoting the thread (by n integer) and set this when creating an instance, and later just read it for the appropriate purpose... -Michael

Re: [fpc-pascal] Threadvar member field

2017-03-21 Thread Michael Schnell
On 17.03.2017 17:13, Karoly Balogh (Charlie/SGR) wrote: This is actually entirely platform specific. The underlying implementation of threadvars is very different for each platform, and highly depends both on the CPU arch and the OS. That might be true. Last time I checked (several years

Re: [fpc-pascal] Threadvar member field

2017-03-17 Thread African Wild Dog
2017-03-17 5:50 GMT-03:00 Michael Schnell : > On 16.03.2017 19:38, African Wild Dog wrote: > >> I have a class where its instances are shared between multiple threads. >> How can I declare one variable per instance per thread? >> > Does this really make sense ? > > Accessing

Re: [fpc-pascal] Threadvar member field

2017-03-17 Thread Karoly Balogh (Charlie/SGR)
Hi, On Fri, 17 Mar 2017, Michael Schnell wrote: > Accessing threadvars (in fpc) costs a lot more CPU cycles (i.e. involves > an OS call) than accessing normal variables. This is actually entirely platform specific. The underlying implementation of threadvars is very different for each platform,

Re: [fpc-pascal] Threadvar member field

2017-03-17 Thread Michael Schnell
On 16.03.2017 19:38, African Wild Dog wrote: I have a class where its instances are shared between multiple threads. How can I declare one variable per instance per thread? Does this really make sense ? Accessing threadvars (in fpc) costs a lot more CPU cycles (i.e. involves an OS call) than

Re: [fpc-pascal] Threadvar member field

2017-03-16 Thread Michael Van Canneyt
On Thu, 16 Mar 2017, African Wild Dog wrote: I have a class where its instances are shared between multiple threads. How can I declare one variable per instance per thread? The code below does not compile (fpc 3.0.0): TMyClass = class public threadvar MyValue: Integer; end; This is not