Results 1 to 6 of 6

Thread: What is the default priority of the Ice thread ?

  1. #1
    russule is offline Registered User
    Name: Lei Chun
    Organization: www.channelsoft.com.cn
    Project: Conf
    Join Date
    Oct 2006
    Posts
    32

    What is the default priority of the Ice thread ?

    Hi,
    What is the default priority of the Ice thread ?Can I set the priority of the Ice thread?

    Thanks,

  2. #2
    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 change thread priorities, so the priority of a thread is whatever the operating system chooses as default. Ice does also not have an API to change thread priority. You have to do this using the native thread API of your platform.

  3. #3
    russule is offline Registered User
    Name: Lei Chun
    Organization: www.channelsoft.com.cn
    Project: Conf
    Join Date
    Oct 2006
    Posts
    32
    Hi marc,
    I used Ice-3.2.0, using the thread-pool model in windows 2003 server.As you saying, Ice does not change thread priorities.This is to say,there is no way to change the thread priorities?

    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
    No, you cannot change the priorities of the threads from the 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
    While Ice does not provide some special thread-priority setting, it gives you the ability to register a callback that runs in any thread created by an Ice communicator:

    Code:
    class ThreadNotification : public IceUtil::Shared
    {
    public:
    
        virtual void start() = 0;
        virtual void stop() = 0;
    };
    
    typedef IceUtil::Handle<ThreadNotification> ThreadNotificationPtr;
    
    //
    // Communicator initialization info
    //
    struct InitializationData
    {
        PropertiesPtr properties;
        LoggerPtr logger;
        StatsPtr stats;
        StringConverterPtr stringConverter;
        WstringConverterPtr wstringConverter;
        ThreadNotificationPtr threadHook;
    };
    In start() you could change the priority of the current thread, e.g. implement start as:

    Code:
    SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN);
    Please note:
    - we did not test such thread-priority modification
    - this thread-notification callback applies to all threads created by a communicator, not just the threads in a specific thread pool

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  6. #6
    russule is offline Registered User
    Name: Lei Chun
    Organization: www.channelsoft.com.cn
    Project: Conf
    Join Date
    Oct 2006
    Posts
    32
    Hi bernard,
    I tried this method, and it can change the priorities of the threads created by an Ice communicator to register a callback .

    Thank you very much!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Ice Default Logger usage
    By danleepw in forum Help Center
    Replies: 1
    Last Post: 05-07-2010, 02:42 AM
  2. About default servants...
    By Yos in forum Help Center
    Replies: 1
    Last Post: 08-03-2009, 06:37 AM
  3. Ice.Default.Locator and stand-alone IceBox service
    By aerskine in forum Help Center
    Replies: 2
    Last Post: 02-19-2009, 03:21 PM
  4. set string to default in .ice file???
    By shadowdog in forum Help Center
    Replies: 3
    Last Post: 03-10-2006, 09:50 AM
  5. Ice.Default.Locator
    By xdm in forum Help Center
    Replies: 8
    Last Post: 05-31-2005, 08:52 AM

Posting Permissions

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