5 Replies Latest reply on Aug 15, 2013 2:29 AM by ShuiXin Zhang

    Why thr_setprio method will fail on Solaris 11?

    ShuiXin Zhang

      Hi all,

      I used the below test code to run on Solaris 11 and Solaris 10. But the method thr_setprio will fail with return code 1, which means "The caller does not have the appropriate permission to set the priority to the value specified."

      It can work well on Solaris 10. I used the same executable file "test", which is compiled on Solaris 11 or Solaris 10.


      Solaris 11 platform information.

      bash-4.1$ CC -V

      CC: Sun C++ 5.12 SunOS_sparc 2011/11/16

      Oracle Corporation      SunOS 5.11      11.0    November 2011


      The result in Solaris 11

      bash-4.1$ ./test

      ******my set prio result: 1


      Thread run over.


      Solaris 10 platform information:

      bash-3.00$ CC -V

      CC: Sun C++ 5.8 2005/10/13

      Sun Microsystems Inc.   SunOS 5.10      Generic January 2005


      The result in Solaris 10.

      bash-3.00$ ./test

      ******my set prio result: 0


      Thread run over.


      #include "thread.h"
      #include "stdio.h"
      static void * Hello(void* arg)
        return 0;
      static void mythread()
      thread_t tid;
      int ret;
      int newprio = 20;
      /* suspended thread creation */
      ret = thr_create(NULL, NULL, Hello, NULL, THR_SUSPENDED, &tid);
      /* set the new priority of suspended child thread */
      ret = thr_setprio(tid, newprio);
      printf("******my set prio result: %d\n", ret);
      /* suspended child thread starts executing with new priority */
      ret = thr_continue(tid);
      ret = thr_join(tid, NULL, NULL);  
      printf("Thread run over.\n");
      void main(int argc, char **argv)