C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is printf thread-safe?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Steven
Guest





PostPosted: Thu Jun 26, 2003 1:06 am    Post subject: Is printf thread-safe? Reply with quote



Is printf thread-safe?

Someone tell me it isn't, however, I think it is.
If it isn't, then why?

Thank you in advance.
--
Steven Ding
Back to top
Artie Gold
Guest





PostPosted: Thu Jun 26, 2003 1:17 am    Post subject: Re: Is printf thread-safe? Reply with quote



Steven wrote:
Quote:
Is printf thread-safe?

Yes. No. Maybe.
Since neither standard C nor standard C++ define a thread model, there's
no way to answer this question in the context of either newsgroup.

Quote:

Someone tell me it isn't, however, I think it is.
If it isn't, then why?

It's an implementation issue. Please ask in a forum specific to your

platform -- or in news:comp.programming.threads.

HTH,
--ag

--
Artie Gold -- Austin, Texas



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

Back to top
Steven
Guest





PostPosted: Thu Jun 26, 2003 1:35 am    Post subject: Re: Is printf thread-safe? Reply with quote



Artie Gold <agold (AT) bga (DOT) com> wrote in news:3EFA49BE.9060509 (AT) bga (DOT) com:

Quote:
Yes. No. Maybe.
Since neither standard C nor standard C++ define a thread model,
there's no way to answer this question in the context of either
newsgroup.

It's an implementation issue. Please ask in a forum specific to your
platform -- or in news:comp.programming.threads.

HTH,
--ag


I get it!
Thank you very much. :)

--
Steven Ding

Back to top
Alexander Terekhov
Guest





PostPosted: Thu Jun 26, 2003 10:54 am    Post subject: Re: Is printf thread-safe? Reply with quote


Steven wrote:
Quote:

Is printf thread-safe?

http://groups.google.com/groups?selm=3E29B01E.41A4E99D%40web.de

regards,
alexander.

Back to top
Vijay B
Guest





PostPosted: Thu Jun 26, 2003 10:24 pm    Post subject: Re: Is printf thread-safe? Reply with quote

Hi

No the printf thread is not a safe one as we always use only one
output buffer for the printf's. As a result of this the printf
statements on a multi-threaded application are not safe. resort to
other techniques or place locks before printf(check to avoid
deadlocks). Use system calls such as read and write ..reading and
writing from standard output and standard input instead as these are
multi-processor and multi-thread safe.

Vijay

Steven <wjding (AT) szapsoft (DOT) com> wrote

Quote:
Is printf thread-safe?

Someone tell me it isn't, however, I think it is.
If it isn't, then why?

Thank you in advance.

Back to top
Chris Torek
Guest





PostPosted: Fri Jun 27, 2003 12:02 am    Post subject: Re: Is printf thread-safe? Reply with quote

Quote:
Steven <wjding (AT) szapsoft (DOT) com> wrote

Is printf thread-safe?

In article <65637de2.0306261424.50869384 (AT) posting (DOT) google.com>
Vijay B <vijbala (AT) hotmail (DOT) com> writes:
Quote:
No the printf thread is not a safe one as we always use only one
output buffer for the printf's.

I have already noted elsethread that this is system-dependent; I
will now add that, for BSD/OS, printf() *is* thread-safe.

How do you know the OP is using your particular system?
--
In-Real-Life: Chris Torek, Wind River Systems (BSD engineering)
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://67.40.109.61/torek/index.html (for the moment)
Reading email is like searching for food in the garbage, thanks to spammers.

Back to top
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
 


Powered by phpBB © 2001, 2006 phpBB Group