1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #include <Ice/Ice.h>
6 #include <TestI.h>
7 
8 using namespace Test;
9 using namespace std;
10 
PriorityI(const Ice::ObjectAdapterPtr & adapter)11 PriorityI::PriorityI(const Ice::ObjectAdapterPtr& adapter) :
12     _adapter(adapter)
13 {
14 }
15 
16 void
shutdown(const Ice::Current &)17 PriorityI::shutdown(const Ice::Current&)
18 {
19     _adapter->getCommunicator()->shutdown();
20 }
21 
22 int
getPriority(const Ice::Current &)23 PriorityI::getPriority(const Ice::Current&)
24 {
25 #ifdef _WIN32
26     return GetThreadPriority(GetCurrentThread());
27 #else
28     sched_param param;
29     int sched_policy;
30     pthread_t thread = pthread_self();
31     pthread_getschedparam(thread, &sched_policy, &param);
32     return param.sched_priority;
33 #endif
34 }
35