Results 1 to 5 of 5

Thread: Thread and Timer Questions (Windows 7, 64 bit)

  1. #1
    billg is offline Registered User
    Name: Bill Gw
    Organization: WMS
    Project: Games
    Join Date
    Apr 2011
    Posts
    11

    Thread and Timer Questions (Windows 7, 64 bit)

    These questions are with respect to running in a real-time environment (under Windows 7, 64-bit Embedded).

    * What are the "int priority" value parameters for both the Timer and Thread classes (do these equate to Windows thread priority values?, an ICE defined enumeration?, is 1 low or high?, what is the range?, etc.) - I can't seem to find any documentation.

    * It seems that the priority functions can only be used when running as an Administrator - is that true? (Otherwise trying to set the priority generates exceptions for both threads and timers.)

    * However, running as an administrator, it seems like I can still generate exceptions when creating a timer (a priority of '5' worked, but '18' generated exception - but not always repeatable).

    * What exactly is happening when the ICE priority is raised \ lowered? (Same as setting the thread priority in Windows via SetThreadPriorityAPI()?)

    * Is it possible to raise \ lower the priority during thread execution?

    * To run a periodic code function, which is more efficient (scheduler, overhead of system, etc.) \ would you recommend running an Ice thread and sleep() or a timer and scheduleRepeated()?

    Thanks for the help.

  2. #2
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    What are the "int priority" value parameters for both the Timer and Thread classes (do these equate to Windows thread priority values?, an ICE defined enumeration?, is 1 low or high?, what is the range?, etc.) - I can't seem to find any documentation.
    The priority value is system-dependent; On Windows systems, the priority value is passed through to the Windows setThreadPriority function.

    see: Threads

    It seems that the priority functions can only be used when running as an Administrator - is that true? (Otherwise trying to set the priority generates exceptions for both threads and timers.)
    Running as an Administrator isn't necessary, have you try to run the priority test as non Administrator user? the test is in "cpp/test/IceUtil/priority" it should work with a normal User, do you get the same exceptions with the test? we have tested Windows 7 x64, but not Windows 7 x64 Embedded, maybe there is some differences in that OS version.

    * However, running as an administrator, it seems like I can still generate exceptions when creating a timer (a priority of '5' worked, but '18' generated exception - but not always repeatable).
    18 isn't a valid priority in windows, see here Scheduling Priorities (Windows)

    What exactly is happening when the ICE priority is raised \ lowered? (Same as setting the thread priority in Windows via SetThreadPriorityAPI()?)
    Yest Ice just call SetThreadPriority.

    Is it possible to raise \ lower the priority during thread execution?
    No, it isn't , you can just set the priority when start a thread, but it cannot be changed later.

    To run a periodic code function, which is more efficient (scheduler, overhead of system, etc.) \ would you recommend running an Ice thread and sleep() or a timer and scheduleRepeated()?
    You should use scheduleRepeated that is designed to run a periodic function, in general you should avoid using sleep.

  3. #3
    billg is offline Registered User
    Name: Bill Gw
    Organization: WMS
    Project: Games
    Join Date
    Apr 2011
    Posts
    11
    Thanks (and apologies ... I missed the part in the documentation where it said the priority is passed through to SetThreadPriority in Windows).

    I don't see any /cpp/test/IceUtil/ directory (or anything close to that) in my ICE install directory (3.4.1) and searched my hard drive and can't find the dir or executable. Do I need to install something else to get this utility?

    As for Administrator \ non-Administrator exceptions, the exception generated is "IceUtil::ThreadSyscallException" if that helps.

  4. #4
    billg is offline Registered User
    Name: Bill Gw
    Organization: WMS
    Project: Games
    Join Date
    Apr 2011
    Posts
    11
    FYI ... It looks like if I change the priority values to those defined in Windows documentation (THREAD_PRIORITY_TIME_CRITICAL, THREAD_PRIORITY_NORMAL, etc.) all seems fine in non-Admin. mode. Many apologies, if I had seen the Windows reference in the documentation the first time, I would have saved you the time on this one.

    All is fine - thanks again for the help.

  5. #5
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    The test suite is part of our source distributions, ZeroC - Download

    It Windows is better to use the constants THREAD_PRIORITY_TIME_CRITICAL, ...., when using numbers they depend on the "Process priority class" Ice doesn't change the priority class at all, so a priority number can be valid with a priority class but not with others.

    Glad things are working for you.
    Last edited by xdm; 04-20-2011 at 04:11 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. 64-bit unsigned integer specified in Slice
    By ShaChris23 in forum Help Center
    Replies: 1
    Last Post: 12-04-2009, 04:20 AM
  2. Compile 64 bit ice on non 64 bit OS
    By Andrew S in forum Help Center
    Replies: 2
    Last Post: 03-31-2009, 01:43 PM
  3. 64-bit JVM support?
    By vincei in forum Comments
    Replies: 2
    Last Post: 03-18-2008, 01:41 PM
  4. Patch for Berkeley DB 4.3 64-bit
    By bernard in forum Patches
    Replies: 0
    Last Post: 08-16-2005, 11:16 AM
  5. Ice 1.2.0 tests fail on 64 bit platform
    By rbx in forum Help Center
    Replies: 2
    Last Post: 02-18-2004, 09:04 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
  •