LINUX programming

Moderators: ITA
Number of threads: 1347
Number of posts: 2935

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Semaphore aquiring issue in a Process,which is spawned by other proc Posted by viv2012 on 8 Mar 2012 at 8:51 PM
Hi,

I am building a system where a script will start one process (suppose the process name is procA). This procA will in turn spawn another process (procB) through execv(). The environment is Linux and the coding language used is C/C++.

If the script content is "./procA &" means if procA is started in background, procB (which is spawned by procA) does not starts properly. That happens because procB while starting tries to get a semaphore, which it could not get and hangs there. This is the first place where it tries to get that semaphore so no possibility of the semaphore to be locked by someone else.

Even strange is, when the script content is "./procA" means procA is started in foreground, this problem does not arise and procB starts properly. Its also able to get that semaphore.

Can some one please help??

Thanks,
viv2012



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.