[dba-VB] c# lock()

jwcolby jwcolby at colbyconsulting.com
Sun Mar 27 22:20:36 CDT 2011


OK, so I have explained the process.  As you can see I am using threads pretty heavily.  In general 
only one thread writes to any given flag field in a class and in general only one (other) thread 
reads from that flag.  However threads are peeking at flags all the time "checking" whether the 
chunk (in particular) is ready to proceed to the next stage.

This weekend I decided to try a dedicated flag class.  My idea is simply that each flag represents a 
field in a table.  Each flag represents a specific data element from a specific record.  It is only 
written once (generally) but potentially read  often.  If I build a dedicated flag class it can be 
initialized with the table / field / pkid etc for its specific field / record and then when the 
thread writes the flag, the flag class can write its value out to the right field / record table. 
Again it is normally only ever written once.  Most of my flags are a date / time that the process 
step occurred.

So I am trying to wrap the whole flag concept into a class to allow me to process (read / write / 
test) flags in an identical way in all of my process classes.

It was this flag class which I was discussing the end of last week.  It will be accessed by at least 
two threads so it needs to be thread safe.

John W. Colby
www.ColbyConsulting.com

On 3/27/2011 8:08 PM, Shamil Salakhetdinov wrote:
> Hi John --
>
> Yes, I see: you tend to build a multi-threaded application/utility system
> with centralized control - and I tend to build an anarchical free-market
> model based application/utility system :)
>
> Thank you.
>
> --
> Shamil



More information about the dba-VB mailing list