Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Nov : Critical Sections

www.cryer.info
Managed Newsgroup Archive

Critical Sections

Subject:Critical Sections
Posted by:"Bandit" (bjon..@usenet.com)
Date:Fri, 11 Nov 2005 23:49:10 +0100

Dear All,

I have an application with multiple threads and multiple pointers to data.
The data needs to be accessed by all threads.

I need to access the pointers/data in the following way:

1) Allocating and writing
2) Changing data
3) Reading data
4) Reading data (non important)

All these actions are today protected by critical-sections. But when the
amount of data increases the synchronisation make the application slower.

Since 75% of the reading of the data is "non important" I wonder if I can
skip the critical-section when reading this data or can this have some
unexpected results? (I do these "non important" reads to provide statistics,
but these statistics does not need to be 100% accurate)

B

Replies:

www.cryer.info
Managed Newsgroup Archive