Results 1 to 6 of 6
hi all
can fork is used as a thread?
tnak you in advance...
- 04-05-2007 #1Linux Newbie
- Join Date
- Feb 2007
- Location
- hyderabad, india
- Posts
- 247
fork()
hi all
can fork is used as a thread?
tnak you in advance
- 04-05-2007 #2Just Joined!
- Join Date
- Jan 2007
- Posts
- 90
yes.
But fork creates processes. So the entire process will be duplicated and not just another instance of the thread !
- 04-05-2007 #3Just Joined!
- Join Date
- Feb 2007
- Posts
- 12
how do i make a process sleep for n seconds?
i'm having a problem, when i create a process like
child2 gets printed twice. once as a 0 and once as its real process id. how can i make it print only once?Code:child2 = fork(); printf("%d", child2);
- 04-05-2007 #4
Hi,
Printf() is called once by ur parent process then by child process.so u get tw o ouptuts.
child process pid is always zero and parent process greater than zero.
use sleep() or wait() to delay process.
i found this link simple and easy
http://www.secgeeks.com/?q=node/201- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 04-06-2007 #5Linux Newbie
- Join Date
- Feb 2007
- Location
- hyderabad, india
- Posts
- 247
yeah..
i used pthreads concept
pthread_t thread1;
int iret1;
iret1=pthread_create( &thread1, NULL, myfunction, NULL);
//pthread_join( thread1, 0);
here my function having gtk application(gui)
in this it calls the browser, when the browser calls using threads my gui application getting
hanged, for that i used
pthread_join( thread1, 0);
still it is hanging..
i used this thread in othen function(not in main()).
can any help?
thank you in advance
- 04-06-2007 #6Just Joined!
- Join Date
- Feb 2007
- Posts
- 12
thx Laksh, that was helpful


Reply With Quote