LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-22-2003, 09:25 AM   #1
Jo_Nak
LQ Newbie
 
Registered: Jun 2003
Posts: 20

Rep: Reputation: 0
question about threads


Hi!

I am programming in C++. This is the situation: I have a main thread that takes care of the interactions of the user and the GUI. Then I have 4 threads running in the background. Each thread maintains a STL vector declared:
vector<TBitmap*> VectorFrame;

How can I pass this vector to the main thread (because it is not a pointer)?

I thought maybe mapping it into a location in the memory. Is it a good way and how do I do that? Is there a better way?


Thanks a lot.
Any help is greatly appreciated.

J.N.
 
Old 08-23-2003, 11:43 AM   #2
tda
Member
 
Registered: Mar 2002
Location: Ukraine, Kiev
Distribution: Mandrake 7.2
Posts: 37

Rep: Reputation: 15
Re: question about threads

Quote:
Originally posted by Jo_Nak
Hi!

I am programming in C++. This is the situation: I have a main thread that takes care of the interactions of the user and the GUI. Then I have 4 threads running in the background. Each thread maintains a STL vector declared:
vector<TBitmap*> VectorFrame;

How can I pass this vector to the main thread (because it is not a pointer)?

I thought maybe mapping it into a location in the memory. Is it a good way and how do I do that? Is there a better way?


Thanks a lot.
Any help is greatly appreciated.

J.N.
You can define this vectors in static context (outside function) or somewhere else where they will be accessiblle both in main() and in your threads. In this way you must use some synchronization methods to acceess this vectors from different threads.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java threads listed using kill -3 does not contain all threads found using ps -auxww coneheed Programming 2 11-14-2005 08:57 AM
How often do threads go ot? lectraplayer General 5 09-26-2005 09:26 PM
Java Threads vs Native Threads rjmendez Programming 0 08-16-2004 05:58 AM
question about subscribtion to threads lyceum LQ Suggestions & Feedback 8 07-09-2004 01:15 PM
maximum # of threads question amar Linux - General 5 06-04-2003 06:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration