 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Steven Guest
|
Posted: Thu Jun 26, 2003 1:06 am Post subject: Is printf thread-safe? |
|
|
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
|
Posted: Thu Jun 26, 2003 1:17 am Post subject: Re: Is printf thread-safe? |
|
|
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
|
Posted: Thu Jun 26, 2003 1:35 am Post subject: Re: Is printf thread-safe? |
|
|
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
|
|
| Back to top |
|
 |
Vijay B Guest
|
Posted: Thu Jun 26, 2003 10:24 pm Post subject: Re: Is printf thread-safe? |
|
|
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
|
Posted: Fri Jun 27, 2003 12:02 am Post subject: Re: Is printf thread-safe? |
|
|
| 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 |
|
 |
Powered by phpBB © 2001, 2006 phpBB Group
|