473,411 Members | 1,991 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,411 software developers and data experts.

Thread spawning

I'm inside a function where I have a static cache, when the cache needs to
be updated I want to do it asyncronously, because updating the cache takes a
while. I want to use thread safety when writing and reading the cache (a
Mutex?)

Private Function Count(ByVal Guid)As Int32
Static Dim countResults As Hashtable = New Hashtable
Static Dim countResultTimestamps As Hashtable = New Hashtable
'Here I want to call CacheUpdateCount(countResults,
countResultTimestamps, Guid) in a new asyncronous thread updating the static
cache
Return countResults(Guid)
End function

Private Function CacheUpdateCount(ByRef countResults As Hashtable, ByRef
countResultTimestamps As Hashtable, ByVal Guid)
'Update static cache
end function

1 ) How do I spawn a new thread calling the CacheUpdateCount() method?
2) How do I ensure that I don't read and write the cache at the same time?

Kind Regards,
Allan Ebdrup
Nov 21 '05 #1
0 882

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

Similar topics

9
by: phil | last post by:
And sorry I got ticked, frustrating week >And I could help more, being fairly experienced with >threading issues and race conditions and such, but >as I tried to indicate in the first place,...
0
by: Marco Nicosia | last post by:
Hello gang, My coworker and I are writing a Python class for the other developers within our team. This class is supposed to encapsulate several things, including daemonizing, setting up...
1
by: siva sanks | last post by:
Hello, I have a situation, in which, we would be calling the external interfaces from our application. For some reason, the external interface call doesnt produce any time outs and it hangs for...
8
by: JS | last post by:
I am monitoring/controlling some realtime activities in a manufacturing process. When a part comes into my station, I have a bunch of processing to do. There are 30-40 data acquisition and data...
10
by: Lenn | last post by:
Hello, I have always used a certain design pattern for multithreaded Windows app; Start new worker thread from UI thread, use events to notify UI threads when something happens, update UI...
1
by: Sanjay Kedare | last post by:
Hi, How safe it is to spawn a thread to do some routine job from Application_Start event of ASP.NET Also whenever the ASPNET worker process restarts, will the Application_Start event be...
3
by: Joe Befumo | last post by:
This is my first attempt at multi-thread programming, and I'm encountering a program-logic problem that I can't quite put my finger on. The program is pretty simple. I'm trying to validate a...
0
by: sam.m.gardiner | last post by:
My situation is I am writing in vb.net 1.1. I have created an interface that I expect people to implement in new classes. I have a service that will respond to remote calls, instantiate one of...
15
by: dani kotlar | last post by:
I am trying to make a client-server application to run, but I am running into this problem: in the server Form the call InitializeComponent(); creates a text-box. Later the calls: readThread =...
4
by: Diffident | last post by:
Hi All, I am trying to perform a non-CPU bound operation in an asynchronous fashion using 'Thread' and a delegate. Basically, I am spawning a thread using ThreadStart and Thread. My non-CPU...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.