473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ReaderWriterLock for Less Critical Session

I have a public shared DateTime type variable called [LastAccessTime]. There are multiple work threads updating this variable to current time (Now). Normally, the DateTime variable is updated 10-100 times per second by work thread(s). The Main thread will read the variable value every three seconds. If the variable was not updated for 10 seconds, the main thread will take some actions

The value for this datetime variable is less critical to main thread. My question is: The work thread update the variable without synchronization control, does main thread always read either old value or new value? I just worry main thread may read some bad value like Null, or the time of one hundred years before, because work thread updates are not atom

I also have a 20K length byte array. Because CPU may take more time to update it, so I control it with a ReaderWriterLock. If I don’t care of the value of old or new value (not other value), can I get rid of ReaderWriterLock

Thanks

Nov 16 '05 #1
0 1943

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: asimeerza | last post by:
hi all i m developing web applicaiotn with vb+asp dot net. i ve many links at my page and i m also maintaining session. if the user of my applicaton clicks one link that sends request to the...
1
by: bajopalabra | last post by:
hi if i disable session state... how can i identify the user session ??? and, assuming that i generate my own "session id" for each login carrying it along the requests... how can i, latter,...
2
by: pokémon | last post by:
Question: Is this thread-safe: ReaderWriterLock rwl = new ReaderWriterLock(); Queue q = new Queue(); public int GetCount() { int val = 0; try {
2
by: Tryion | last post by:
Hi, I'd like to know if it's possible/responsible to use the ReaderWriterLock class (RWL) in a class without declaring it as "static". The example in the SDK does not use a static RWL. However,...
3
by: J.Marsch | last post by:
Issue: I have 3 threads, syncing with a ReaderWriterLock (in "real life", there will be more). Thread 1 (there could be any number of these) Gets a read lock with infinite timeout. It runs in...
6
by: Itay | last post by:
Hi , Is there a way to lock several ReaderWriterLock in an atomic manner? I have numerous amount of ReaderWriterLock objects and I need to lock some of them for reading only, is there a way...
4
by: Anders Borum | last post by:
Hello! I am working on improving my threading skills and came across a question. When working with the ReaderWriterLock class, I am getting an unhandled exception if I acquire a WriterLock with...
7
by: Julie | last post by:
According to the documentation for the Acquire methods on the ReaderWriterLock class: -1 Infinite. 0 No time-out. > 0 The number of milliseconds to wait. ...
1
by: fm | last post by:
I have a public shared property in global.asax. When the variable of the property is not instantiated (first page to call it, cache empties, etc.) the code then loads the variable from source...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.