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

Thread Syncronization

Hi,

i'm trying to grasp the concept of syncronizing threads, but without success

Here is the situation:

I'm using an object which connects to a server. After connection i want to
send informational requests.
If i send a request and the object is not connected yet i tell the Component
to connect(sub RequestInfo).
But before sending the request i have to wait until the connection succeded.
This is told to me by a Event (Sub Open_Result)
There are 2 options 1 is by using doEvents() in a loop, but that is using up
resources, the second is syncronizing Threads.
Could anyone help me?

Thanks in advance!

Rob Smeets

See below for simplified sample

Class GetInfo
Private withevents objInformationService as New InformationService
Private Connected as boolean = False

private Sub Connect()
objInformationService.Connect("UserName", "Password")
end sub

Private Sub RequestInfo(SelectStatement as string)
If Me.connected = False then
Me.Connect()
End if
objInformationService.RequestInfo(SelectStatement)
End sub

Private Sub Open_Result(Result as integer, ErrorMessage as string) handles
objInformationService.Openresult
If result = 1 then
Connected = True
Else
msgbox ErrorMessage
end if
End Sub
End Class
Jan 11 '06 #1
0 795

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

Similar topics

8
by: Mountain Bikn' Guy | last post by:
I'm using async delegate calls. I would like to re-enter my initial thread after the callback. (I'm not using UI controls, so Control.Invoke is not the solution.) How can I manually implement...
20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone...
12
by: Andrew Bullock | last post by:
Hi, I'm using a second thread within my program to do some long calculations, without locking up the UI: worker = new Thread(new ThreadStart(myClass.Run)); worker.Start(); I want to be...
2
by: White Spirit | last post by:
I've read that it is not recommended to use Thread.Suspend and Thread.Resume to control execution of threads and that use of the Monitor class is preferred. I'm writing a server that lets users...
15
by: Laser Lu | last post by:
I was often noted by Thread Safety declarations when I was reading .NET Framework Class Library documents in MSDN. The declaration is usually described as 'Any public static (Shared in Visual...
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
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...
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...

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.