LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-23-2004, 06:04 PM   #1
markdhorn
LQ Newbie
 
Registered: Jul 2004
Posts: 1

Rep: Reputation: 0
Using system() with pthreads


Is it safe to use the system() function call from a pthread?

I've inherited some code that is heavily using pthread on a Linux 2.4.10 kernel, but it also has many instances of system("<program>").

The system() call will result in a fork() and execve(). I thought I read some place that it wasn't safe to use execve with threads?

The code will SEGV on occasion, but it is very random and seems to be more frequent based on the load of the system; the more thread running the higher chance that it will SEGV.

Is there a good source to reference on if system() is thread safe?

Any help appreciated!
--mark
 
Old 07-24-2004, 04:02 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Solaris manual says system() is not thread safe, and recommend using popen() instead, which is thread-safe.

That may or may not apply to Linux though ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pthreads christheavatar Programming 4 03-05-2005 09:30 PM
pthreads ftgow Linux - Software 0 07-08-2004 03:55 AM
pthreads Keith Hampton Linux - Software 1 10-23-2003 01:46 PM
pthreads on dual Intel Xeon system coxtonyj Linux - General 0 07-25-2003 03:49 AM
pthreads fr0ggeh Linux - Software 9 07-18-2003 10:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration