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

Simple Threading Question

I'm attempting to use threads in .NET VC++ comming from a strict C
background. Unfortunately I'm a bit rough. I've gotten a rather good
knowlege of VC++ and have been converting projects from VB and C# to
learn how to do them in VC++ .NET.

Unfortunately I can't seem to understand something rather trivial. I
guess it escapes me.

I have a class, Form1. It creates 5 threads. Each thread I'd like to
know the parent address in. So I'd like each thread to know and be able
to access the Inital thread (The one Form1 loads from). Inside Form1 I
have a function String^ Form1::getString(); It returns a string of
course. I'd like the threads to call that. I have a mutex placed inside
to force multithreaded safety.

How would I go about defining the parent in the threads. Note the
threads are an instantiation of a totally different class than Form1.

Thanks in advance

Nov 28 '06 #1
1 729
I have a class, Form1. It creates 5 threads. Each thread I'd like to
know the parent address in. So I'd like each thread to know and be able
to access the Inital thread (The one Form1 loads from). Inside Form1 I
have a function String^ Form1::getString(); It returns a string of
course. I'd like the threads to call that. I have a mutex placed inside
to force multithreaded safety.

How would I go about defining the parent in the threads. Note the
threads are an instantiation of a totally different class than Form1.
Hi,

You can use a ParameterizedThreadStart delegate for that, and simply supply
the Form pointer when you start the thread.
See
http://msdn2.microsoft.com/en-us/lib...readstart.aspx
for more information and an example.

--
Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"

Nov 28 '06 #2

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

Similar topics

14
by: adeger | last post by:
Having trouble with my first forays into threads. Basically, the threads don't seem to be working in parallel (or you might say are blocking). I've boiled my problems to the following short code...
38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
3
by: Elliot Rodriguez | last post by:
Hi: I am writing a WinForm app that contains a DataGrid control and a StatusBar control. My goal is to update the status bar using events from a separate class, as well as some other simple...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.