ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Im still learning to program and I have a question about using funtions simultaneously in a program. Mainly I want to know if its possible...and if it is...how to do it.
Lets say I have functions funca(),funcb(), and funcc(). Could my program make them all run at the same time? I dont want to call them in order, I want them to run on parrallel to each other.
is it _really_ necessary that you need this for an intro to c++ program?
but yes it is most definetly possible.. you use threads/processes.
its called 'multi-threaded development' i believe
(sorry no examples)
im sure you have already checked it out but.. this site is a very helpful resource. (doesnt talk about threads etc; just an overall good resource though)
Yes, threading can make two or more threads active simultaneously. However, unless the program is run on a multi-processor system, only one thread (and hence, one function) will receive processor attention at any particular moment in time. In other words, one processor cannot perform two sets of instructions in the same time slot.
multi-threaded apps work on any architecture (well.. no.. i think all Apple, *Nix, and M$ 95+).. but to take advantage of the 2-things-at-once, must have multiple CPUS (or hyperthreading, or hyper transport cpu)
GUI's for example.. every gui (that is interactive) is multi threaded. there are threads for listening for events (ie button clicks etc) and for displaying windows or for controlling the interactions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.