Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-08-2005
josephwinston josephwinston is offline
Registered User
 
 
Join Date: Jul 2005
Posts: 3
Using ICE with OpenSceneGraph

I'm looking for hints or suggestions on using threads correctly when ICE is used with another library that is also threaded. I was thinking about using the Command Processor design pattern and collect command objects into a thread safe queue and then dispatch these objects during a "safe time".
Reply With Quote
  #2 (permalink)  
Old 07-09-2005
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
Hi Joseph,

Ice is fully thread-safe, so I don't understand your question. Could you describe the problem you want to avoid?

Best regards,
Bernard
Reply With Quote
  #3 (permalink)  
Old 07-09-2005
josephwinston josephwinston is offline
Registered User
 
 
Join Date: Jul 2005
Posts: 3
Two questions: OpenSceneGraph (OSG) has a main loop that handles processing events and its threads and I'd assume that ICE has something simular that also handles its events and threads. It's straight forward to decompose OSG's main loop and place it inside another loop that is in the main process. Where do I need to look in ICE's documentation/code on how to do this? Secondly, the OSG code needs to run a fairly constant rate. Does the main loop in ICE ever block?

Thanks
Reply With Quote
  #4 (permalink)  
Old 07-09-2005
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
Ice does not have a main loop. You can use the main thread for whatever you like. Requests are dispatched in separate threads from a thread pool.
Reply With Quote
  #5 (permalink)  
Old 07-09-2005
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
Ice does not have a main loop -- it's not a wrapper on top of a single-threaded library.

Assuming you use Ice and OpenSceneGraph in a server, each Ice request will be dispatched using a thread from the Ice server thread pool; if the request needs to interact with OpenSceneGraph, it will most likely need to enqueue a work-item and wait for OSG's thread to pick up this work-item.

In an Ice client, sending Ice requests from the OSG thread is possible, but can block for various reasons:
- the server is slow to respond (solution: use AMI)
- establishing the connection to the server takes a long time (e.g. because the server is out of thread)
- the client TCP buffer is full (typically because the server is overloaded or deadlocked)
It would be safer, although more complicated, to use a separate thread to send these requests.

Cheers,
Bernard
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


All times are GMT -4. The time now is 11:20 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.