> > This raise the following question : Is a field variable in a class
> > aligned in memory ? (OnMyEvent variable is just a field variable).
>
> I don't know, and it also raises a second question:
> > Reads and writes to variables of
> > other sizes are not guaranteed to be atomic on any platform
Hello Francois,
> Line3: if Assigned(OnMyEvent) then
> Line4: OnMyEvent(Self, MyArg);
Very interesting issue. Because almost all components are coded like
this. Very interesting solution also, clean and simple :)
---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamic
> procedure TMyComponent.TriggerMyEvent(MyArg : Integer);
> begin
>EnterCriticalSection(SomeSection);
>if Assigned(OnMyEvent) then
>OnMyEvent(Self, MyArg);
>LeaveCriticalSection(SomeSection);
> end;
>
> Now we're certain that nothing would change OnMyEvent between the
> "if...th
Hello!
>>> I've found an interesting multithreading issue which is related not only
>>> to
>>> ICS component but many many other components I've seen so far. It is a
>>> race
>>> condition between two thread where one is triggering an event handler and
>>> the other is removing (setting to nil)
>> I've found an interesting multithreading issue which is related not only
>> to
>> ICS component but many many other components I've seen so far. It is a
>> race
>> condition between two thread where one is triggering an event handler and
>> the other is removing (setting to nil) the event hand
Hello!
> I've found an interesting multithreading issue which is related not only to
> ICS component but many many other components I've seen so far. It is a race
> condition between two thread where one is triggering an event handler and
> the other is removing (setting to nil) the event handl