473,805 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running a thread with timeout

Hi,

I'm fairly new to threading and i would like to start a new thread but when
the thread isn't completed within 30 seconds i would like the thread to end
and resume the procedure that started the thread. Preferably with an event.

I tried to find information on the internet but i can't find a sample that i
understand.
The samples that are provided include several other things that i think i
don't need.
Language is a problem and i can't find any (good) samples in my own language.

If you can, please help, it would be greatly appriciated

Thanks in advance!

Rob Smeets

Nov 21 '05 #1
3 1004

My first thought is that if you are "resuming the procedure that started the
thread", you are wanting to block the program until the thread finishes or
times out. If this is the case, do you really need a thread at all?

"Rob Smeets" <Ro*******@disc ussions.microso ft.com> wrote in message
news:DF******** *************** ***********@mic rosoft.com...
Hi,

I'm fairly new to threading and i would like to start a new thread but
when
the thread isn't completed within 30 seconds i would like the thread to
end
and resume the procedure that started the thread. Preferably with an
event.

I tried to find information on the internet but i can't find a sample that
i
understand.
The samples that are provided include several other things that i think i
don't need.
Language is a problem and i can't find any (good) samples in my own
language.

If you can, please help, it would be greatly appriciated

Thanks in advance!

Rob Smeets


Nov 21 '05 #2
Did you try thread.suspend , thread.sleep etc etc it has lot of
options.

Regards,
C#, VB.NET , SQL SERVER , UML , DESIGN Patterns Interview question book
http://www.geocities.com/dotnetinterviews/

Nov 21 '05 #3
Rob,

Would you not try with a more simpler solution. A thread is not something
that stops direct when you abort it etc.

As well can you tell why you want to use threading (as Robin already asked).
Often we see here that people want to use threading and than the only result
is that the application takes more resources and time.

Language should not be a problem, the most activate persons in this
newsgroup are from German, English, Danish, Spanish and Dutch speaking
countries (I hope I forget nobody) and there are a lot of visitors with
other native languages. While your name sound at least Dutch.

Cor
Nov 21 '05 #4

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

Similar topics

9
2164
by: Brian Roberts | last post by:
I have a command line Python program that sometimes takes a bit (several minutes) to run. I want to provide an optional method for an impatient user (me!) to check the status of the program. The type and amount of status information doesn't fit nicely into a --verbose or logger -- either too little or too much information at different points. I think an optional web page would be convenient interface. The Python program would listen...
17
3279
by: Larry Woods | last post by:
I have a server page that has served an HTML page with a "Cancel" button on it, BUT this server page has not completed and is running a 15-30 second process before it completes. I want the browser user to be able to terminate the page before the server process has finished. What I tried was an onClick event that issued a "location.href..." in hopes that this would load this referenced page, etc. but I have found that the browser waits...
10
9893
by: Jacek Pop³awski | last post by:
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for example: os.system("someapplication.exe") and kill it, if it waits longer than let's say 100 seconds
28
12108
by: dcrespo | last post by:
Hi all, How can I get a raised exception from other thread that is in an imported module? For example: --------------- programA.py ---------------
0
2332
by: puff | last post by:
When interfacing to a COM object, is it possible to pump messages in a thread? I'm working on an application that automates IE and needs to monitor IE events (yes I know about Pamie). I'm able to start IE as follows: ie = win32com.client.DispatchWithEvents( object, YamieEvents ) ie.event = win32event.CreateEvent(None,0,0,None) An earlier post by Mark Hammond suggested the ie.event line as a fix to
9
3274
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my problem occurs when i try to show a progress bar. The screen freezes. I know i'm not the first one to ask about it. but i'm looking
13
1606
by: Jordan | last post by:
All, I have a UI form calling a class object that contains a timer that routinely draws intensive information to the screen (~30 fps). The drawing is invoked on the main UI thread. I need the user to be able to interact with the UI while the drawing is happening (dynamically change drawing properties). Since the drawing is happening on the main UI thread, the UI form doesn't receive the user control events consistently (if at all).
1
3310
by: Chrace | last post by:
Hi all, I have a problem with with Thread.Join( Timeout ) where the timeout never occurs. I basically need to make a connection to an AS400 box which works fine. Once in a blue moon the AS400 gets a problem and the way this is handled on AS400 is by hanging. If I was to connect directly this would mean my main process would hang as well, so I've spawned a worker thread and used a Thread.Join( Timeout ) to make sure it always returns with...
3
3185
by: yeye.yang | last post by:
hey everybody Does everybody can help me or give me some advise for the cross thread exception catch Here is what I want to do: I have 2 classes "Scenario" and "Step", which have a System.Thread.Timer for each to control their timeout gestion, in my "main program", I start the "Scenario" and "Step", and I do something between "StepStart" and "StepStop", when "Scenario" or "Step" timeout expired, they raise an "exception", then my "main...
5
6263
by: zxo102 | last post by:
Hello All, I have a system. An instrument attched to 'com1' is wireless connected to many sensors at different locations. The instrument can forward the "commands" (from pyserial's write()) to those sensors. Based on the "commands", the sensors keep sending corresponding data back to the instrument which wraps up those data and put into "com1" . The readlines() of pyserial pick up those data for processing. The data ’string' does...
0
9718
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10617
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10364
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10370
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5545
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.