473,407 Members | 2,306 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,407 software developers and data experts.

asyncronous method call

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 17 '05 #1
1 2164

"Allan Ebdrup" <co****@ofir.com> wrote in message
news:OR**************@tk2msftngp13.phx.gbl...
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


Please post VB related questions to the microsoft.public.dotnet.languages.vb
NG.

Willy.
Nov 17 '05 #2

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

Similar topics

0
by: Ivar | last post by:
Hi, Is SocketOptionName.ReciveTimeout usable with asyncronous socket methods ? With Recive method it works but BeginRecive can't get it working.
1
by: Nathan | last post by:
On my .NET web project I am trying to make an asyncronous call to a function using IAsyncResult. The function will process for about a 1/2 hour. before it completes, the process abruptly ends as...
0
by: Paul Fi | last post by:
what is the point of asyncronously processing requests or responses at channel sinks when we can do asyncronous calls at the .net remoting application level ? do we consider AsyncProcessResponse...
1
by: il RicercatoreSbadato | last post by:
title: asyncronous Socket and EndAccept() question: hi to all, I am working with a server that uses the sockets in a asyncronous way. When I want to STOP the server I do the following: -...
3
by: Pug Fugly | last post by:
I have been using asynchronous threading to handle the button actions on my form (the ones that need to make database calls anyways). I am curious if anyone has found a way to make the calls more...
4
by: aaronwmail-usenet | last post by:
Hi. I'm working on a project where a javascript program will get into the middle of some very complicated operation and then decide it needs to use to download an xml file from a server. ...
1
by: Josema | last post by:
Hi, I made an application that foreach directory that found in the hardisk create a node into a treeview. Of course, to avoid that the user interface gets blocked, i use a handler in a...
2
by: Joe | last post by:
Hello All: I have an executable that makes several asynchronous calls to a web service. The executable increments a counter for each async Web service call and decrements the counter whenever...
3
by: OJ | last post by:
Hi, I have written a small C# 2.0 DLL which acts as a client to a Socket based server over the internet. I have written both synchronous and asynchronous methods to connect, send, and receive data...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...

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.