473,545 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReaderWriterLoc k 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 ReaderWriterLoc k. If I don’t care of the value of old or new value (not other value), can I get rid of ReaderWriterLoc k

Thanks

Nov 16 '05 #1
0 1948

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

Similar topics

1
1589
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 server. before the next page is loaded, user clicks another link. and so on.. i think for each server request, a separate thread is created to respond...
1
1717
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, release the session ? remember that Session_OnEnd( ) don't work well all the time ...
2
3284
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
1714
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, the documentation has the standard disclaimer of "Any public static members of this type are safe for multithreaded operations. Any instance...
3
4011
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 a loop. The readlocks are requested and released very often. Thread 2 (only one, this is my deadlock testing thread) represents a longer running...
6
2145
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 doing it one shot ? Itay.
4
5497
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 a timeout less than the time required to process the code section it protects. The code listed below is just a small application I wrote to check...
7
2760
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. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreadingreaderwriterlockclasstopic.asp Does someone want to explain to me the difference...
1
1457
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 (web service, database, file, etc.) What I want to do is prevent many simultaneous users access this property when it's variable is not instantiated...
0
7478
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7410
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7668
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.