synchronous class [Re: Multi threading support was Re: [fpc-devel] Russian locale information not compatible withFPClocale variables]

2008-07-31 Thread Martin Friebe
IMHO per class may create some problems? but maybe I am just overlooking 
something?


TBar =class( TFoo ) end synchronized class;

Let's say TFoo was declared in another unit, and TFoo was not declared 
Synchronized. Then TFoo code can be entered by anyone at any time.
Even if a thread is in TBar. How would one make sure, that a base class, 
knows about all classes that inherit from it?


Neither can you say the baseclass must also be synchronous class, 
because ultimately there always is TObject. and TObject does not want to 
be Synchronous class, or all Create/destroy would be in critical sections?


It my be possible to work around, this, but it would probably create a 
ig overhead, as every method one very class would have to perform checks 
at runtime.

Similar for instance wide protection.

Regards
Martin

Michael Schnell wrote:


Per class. The question is if it's possible to do this per class 
instance too.
To me Per class does not seem appropriate at all. Per instance in 
fact seems to make sense.


-Michael
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: synchronous class [Re: Multi threading support was Re: [fpc-devel] Russian locale information not compatible withFPClocale variables]

2008-07-31 Thread Micha Nelissen

Martin Friebe wrote:
IMHO per class may create some problems? but maybe I am just overlooking 
something?


TBar =class( TFoo ) end synchronized class;

Let's say TFoo was declared in another unit, and TFoo was not declared 
Synchronized. Then TFoo code can be entered by anyone at any time.
Even if a thread is in TBar. How would one make sure, that a base class, 
knows about all classes that inherit from it?


Why does it need to know? Base classes can't access the fields of 
inherited classes anyway.


Micha
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel