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

multithreading question

Rob
In order to show a loading page, I am attempting to call a function as
part of a new thread, my issue is that the function returns a boolean
if it is succesful since it also calls other functions,,

how can I start this function in its own thread, yet get back its true
or false to know it succeeded?

thanks in advance
r
Nov 18 '05 #1
4 1199
Hi Rob:

One way to do this would be to wrap the function in a delegate.
BeginInvoke will start the function on a background thread, EndInvoke
will allow you to harvest the results.

You'll want to test carefully. Using additional threads in a server
process might not always be a performance / scalability improvement.

--
Scott
http://www.OdeToCode.com

On 8 Sep 2004 10:03:20 -0700, fi*******@att.net (Rob) wrote:
In order to show a loading page, I am attempting to call a function as
part of a new thread, my issue is that the function returns a boolean
if it is succesful since it also calls other functions,,

how can I start this function in its own thread, yet get back its true
or false to know it succeeded?

thanks in advance
r


Nov 18 '05 #2
Rob wrote:
In order to show a loading page, I am attempting to call a function as
part of a new thread, my issue is that the function returns a boolean
if it is succesful since it also calls other functions,,

how can I start this function in its own thread, yet get back its true
or false to know it succeeded?

thanks in advance
r


Rob Howard explained this thing at TechEd Europe 2004 in Amsterdam.
Don't know if Microsoft is happy with it, but you can download his ppt
and wmv here:

http://www.rutgersmit.com/misc/msdn/DEV310.ppt
http://www.rutgersmit.com/misc/msdn/DEV310.wmv (32 MB)

Those two items were published on the TechEd Europe 2004 post conference
DVD.
--

//Rutger

DoDotNet@KICKTHIS_Gmail.com
www.RutgerSmit.com
Nov 18 '05 #3
Hi rob,

If you're firing off a new thread I suggest you fire off this thread onto a
method of an object that your main application thread holds. That way you
can set some sort of state that both share and access. IOW, the new thread
can update a property on the object that the main thread can check or read
at some later point in time.

As Scott mentioned though, you'll want to be real careful with threads on
the server - there are lifetime issues that are very uh funky. It's Ok if
you create a thread and run it in parallel with your ASPX page thread, but
it gets tricky when your thread outlasts the main ASPX thread.

Generally a 'loading...' type page is better done via some sort of
asynchronous request that keeps refreshing until the task is done. This way
the Web Server is not tied up with this process.

Regards,

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Rob" <fi*******@att.net> wrote in message
news:54**************************@posting.google.c om...
In order to show a loading page, I am attempting to call a function as
part of a new thread, my issue is that the function returns a boolean
if it is succesful since it also calls other functions,,

how can I start this function in its own thread, yet get back its true
or false to know it succeeded?

thanks in advance
r

Nov 18 '05 #4
Rob
Rick, since google takes a while to post this stuff, I went ahead and
funny enough came up with a solution to do a loading page which runs
the function in its own thread and checks session variable to see if
its done, and Now I read this!

is it really bad to do it this way, how can the function(which is in
its own thread) not be complete, if it sets the global variable when
its finished, how do I know about lifetime issues is there a way?

thanks for your thoughts
r

"Rick Strahl [MVP]" <ri********@hotmail.com> wrote in message news:<#z*************@TK2MSFTNGP11.phx.gbl>...
Hi rob,

If you're firing off a new thread I suggest you fire off this thread onto a
method of an object that your main application thread holds. That way you
can set some sort of state that both share and access. IOW, the new thread
can update a property on the object that the main thread can check or read
at some later point in time.

As Scott mentioned though, you'll want to be real careful with threads on
the server - there are lifetime issues that are very uh funky. It's Ok if
you create a thread and run it in parallel with your ASPX page thread, but
it gets tricky when your thread outlasts the main ASPX thread.

Generally a 'loading...' type page is better done via some sort of
asynchronous request that keeps refreshing until the task is done. This way
the Web Server is not tied up with this process.

Regards,

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Rob" <fi*******@att.net> wrote in message
news:54**************************@posting.google.c om...
In order to show a loading page, I am attempting to call a function as
part of a new thread, my issue is that the function returns a boolean
if it is succesful since it also calls other functions,,

how can I start this function in its own thread, yet get back its true
or false to know it succeeded?

thanks in advance
r

Nov 18 '05 #5

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

Similar topics

0
by: Jean-Yves Nief | last post by:
hello, I have written a script which is performing some tasks in multithreading mode: the main thread is opening a connection to a distant server and all the threads that I start will have to...
1
by: dixp | last post by:
I'm new to writing multithreaded apps and I have a design question. I have a winforms app and a class which has a method that does processing which is time intensive. I want the user to be able...
0
by: GianGuz | last post by:
In the following example Global is able to create and manage access to objects of any kind (even in a multithreading environment) with and index value attached to. So a Global<0, string> is a...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
16
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
10
by: Marek | last post by:
Hi, I am analyzing Duwamish7 source code boundled with Visual Studio .NET 2003. Could anoybody explain why the Monitor.Enter and Monitor.Exit block is used inside a static constructor? The code...
2
by: Rich | last post by:
Hello, I have set up a multithreading routine in a Test VB.net proj, and it appears to be working OK in debug mode and I am not using synchronization. Multithreading is a new thing for me, and...
2
by: Multithreading problem in vb.net | last post by:
Greetings, I am new to multithreading and I am trying to implement it in my app. This application is distributed application which needs to refresh every say 5 secs to show some activities in...
6
by: MeowCow | last post by:
I will try and make my question with out being too long winded. I have been doing a lot of reading on how to do multithreading and I have implemented the code from the following example on...
7
by: Ray | last post by:
Hello, Greetings! I'm looking for a solid C++ multithreading book. Can you recommend one? I don't think I've seen a multithreading C++ book that everybody thinks is good (like Effective C++ or...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.