Results 1 to 5 of 5

Thread: Using ICE with OpenSceneGraph

  1. #1
    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".

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    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

  3. #3
    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

  4. #4
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    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.

  5. #5
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •