2 functions...
How can I make 2 functions both working in my programme... I read in Volume 2 by Bruce Eckel in chapter Concurency ...but i don't understand very well how I can make this programme work
@Purice
Without any more information, here's the best I can do:
But please tell us what language you're using, at the very least. I've just geussed that you're using C++, if I'm wrong, then my time has been totally wasted. So please save everyone the hassle and give all relevant information.
#include <stdio>void foo()//Defines the first function{ std::cout<< "Function Foo";}void bar()//Defines the second function{ std::cout << "Function Bar";}int main(){ foo();//Runs the first function bar();//runs the second function}
But please tell us what language you're using, at the very least. I've just geussed that you're using C++, if I'm wrong, then my time has been totally wasted. So please save everyone the hassle and give all relevant information.
He mentioned a book about concurency, so I presume what he wants is information regarding threads or something similar. Of course more information is needed...
Yes, you definitely need to give a language. This would be easy in a language designed for this (like Erlang), but more difficult in a language like C or C++. Also, Bruce Eckel never made a book called "Volume 2" that I am aware of.
check out openMP or google threading if your new to this. Just keep in mind that even if you use threads, on a single cpu machine, you'll only ever have one thread executing at once.
Cheers
Chris
Cheers
Chris
Hi... The language is C/C++
I wrong when I say "Volume 2", I want to say "Thinking in C/C++" by bruce
the problem are threads I read in this book something like library "ZThread", but in don't how to using this library
I want to use 2 funtions in program at the same time.
@Purice
I wrong when I say "Volume 2", I want to say "Thinking in C/C++" by bruce
the problem are threads I read in this book something like library "ZThread", but in don't how to using this library
I want to use 2 funtions in program at the same time.
@Purice
Are you *sure* that you want to use threads? Is this really what you want? Chances are, you could do the same thing without using threads with much less of a hassle for you.
Quote:Original post by Ezbez
Are you *sure* that you want to use threads? Is this really what you want? Chances are, you could do the same thing without using threads with much less of a hassle for you.
I'd be interested in knowing how?
Cheers
Chris
Quote:Original post by chollida1Quote:Original post by Ezbez
Are you *sure* that you want to use threads? Is this really what you want? Chances are, you could do the same thing without using threads with much less of a hassle for you.
I'd be interested in knowing how?
Cheers
Chris
Boost.Threads provides a library for portable C++ multithreading. The documentation also starts off with a pretty clear warning about exactly how difficult proper multithreading can be.
The ZThread library the OP mentioned is found on Sourceforge and provides doxygen created documentation.
But those are still threads. The poster said you could run 2 funcitons simultaneously without threads:).
Cheers
Chris
Cheers
Chris
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement