Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/wait.h>
- /*2dretve nastale iz jednog procesa*/
- using namespace std;
- pthread_t dr[2];
- void *dretva(void *)
- {
- cout << "Book iz dretve!"<<endl;
- }
- void proces()
- {
- for(int i = 0; i < 2 ; i++){
- pthread_create(&dr[i],NULL,dretva,NULL);
- }
- for(int i = 0; i < 2 ; i++){
- pthread_join(dr[i],NULL);
- }
- cout << "Bok iz procesa!"<<endl;
- }
- int main(){
- if(fork()==0)
- {
- proces();
- exit(0);
- }
- wait(NULL);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement