Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-22-2007
Edward Bishop Edward Bishop is offline
Registered User
 
Name: Edward
Organization: Sony
Project: Automated Test
 
Join Date: Oct 2005
Location: San Diego
Posts: 31
LoggerUtils not thread safe?

I see that the code in LoggerI.cpp is protected with a global mutex, but it seems that the utilities like Ice::Trace are not.

Even though they send to the logger, their stream is not protected:

Code:
Trace& Ice::operator<<(Trace& out, ios_base& (*val)(ios_base&)) { out.__str() << val; return out; }
Am I right? Should we not share Ice::Trace (Warn, Error) objects between threads?

Thanks,
Edward
__________________
Edward
Reply With Quote
  #2 (permalink)  
Old 02-22-2007
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,061
I think that would be a rather strange usage. The intent is to instantiate them on the stack at the point that you want to trace. For example:

Code:
void
FooI::dosomething(const Ice::Current&)
{
   if(_traceLevel > 0)
   {
      Ice::Trace trace("FooI", _logger);
      trace << "dosomething";
   }
   ...
}
Reply With Quote
  #3 (permalink)  
Old 02-23-2007
Edward Bishop Edward Bishop is offline
Registered User
 
Name: Edward
Organization: Sony
Project: Automated Test
 
Join Date: Oct 2005
Location: San Diego
Posts: 31
OK, that make sense. Thanks for your help.

-Edward
__________________
Edward
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Abort thread in C# acbell Help Center 1 01-03-2006 05:05 PM
where to invoke the new Thread in AMD vijaykrishna Help Center 1 06-16-2005 06:31 AM
Thread problem minifat Help Center 1 06-07-2005 10:57 AM
a thread problem fw_csha Help Center 2 05-15-2005 06:41 AM
Ice::Thread and GUI with Qt catalin Help Center 5 09-08-2004 11:20 AM


All times are GMT -4. The time now is 12:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.