Note that pthread.h as you mentioned (POSIX Thread) should be available by default with GCC, so simply including it in your C file will do that job, in case it's not available, a simple Google search should help. Where, switch -o is optional, but provided to mention name of Binary file which should be created out of your source. The function to be executed in the new thread. Now following is the syntax to compile your C source file, run following where your file is: gcc MyProgram.c -o MyProgram Thread Creation: pthreadcreate () int pthreadcreate (pthreadt thread, const pthreadattrt attr, void (start) (void ), void arg) Purpose: Create a new thread. We bring the best to bring out the best in You. If you you see error like Fatal error: file not provided (not sure exact error message, but should be something similar), that means you have compiler ready.Īnd for editing your Code, you can use already available Gedit, just search for it in Dash. We are a clothing brand dealing in silk, handloom sarees and mekhala chador. For example, the following shows the macros that. It is most effective on multi-processor or multi-core systems where the process flow can be scheduled to run on another processor thus gaining speed through parallel or distributed. It allows one to spawn a new concurrent process flow. Then you can test if you have it installed by running gcc. pthread tells the compiler to link in the pthread library as well as configure the compilation for threads. The POSIX thread libraries are a standards based thread API for C/C++. First thing you'll need in Ubuntu to compile C/C++ programs is installing GCC (Gnu Compiler Collection) which is part of build-essential package, do that by running: sudo apt-get install build-essential
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |