// See the LICENSE file in the project root for more information.
/*=====================================================================
-**
+**
** Source: test8.c (DuplicateHandle)
**
** Purpose: Tests the PAL implementation of the DuplicateHandle function,
** with a handle from GetCurrentThread. The test will create a thread
-** handle, get the current thread and its duplicate. Then get the
+** handle, get the current thread and its duplicate. Then get the
** priorities of the threads, set the priority of one and the change
** should be seen in the other.
**
int __cdecl main(int argc, char* argv[])
{
- HANDLE hThread;
- HANDLE hCurrentThread;
- HANDLE hDupThread;
+ HANDLE hThread;
+ HANDLE hCurrentThread;
+ HANDLE hDupThread;
DWORD dwThreadId = 0;
LPTHREAD_START_ROUTINE lpStartAddress = &CreateTestThread;
*/
printf("paltest_duplicatehandle_test8 has been disabled on this platform\n");
#else
-
+
/* Create a thread.*/
hThread = CreateThread(NULL, /* SD*/
(DWORD)0, /* initial stack size*/
**
** Source: GetCurrentThread/test1/thread.c
**
-** Purpose: Test to ensure GetCurrentThread returns a handle to
+** Purpose: Test to ensure GetCurrentThread returns a handle to
** the current thread.
**
** Dependencies: GetThreadPriority
** SetThreadPriority
-** Fail
+** Fail
** Trace
-**
+**
**
**=========================================================*/
#include <palsuite.h>
-int __cdecl main( int argc, char **argv )
+int __cdecl main( int argc, char **argv )
{
- HANDLE hThread;
+ HANDLE hThread;
int nPriority;
-
+
if(0 != (PAL_Initialize(argc, argv)))
{
return ( FAIL );
Some platforms like NetBSD cannot reassign it as they are dynamic.
*/
printf("paltest_getcurrentthread_test1 has been disabled on this platform\n");
-#else
+#else
hThread = GetCurrentThread();
-
+
nPriority = GetThreadPriority(hThread);
if ( THREAD_PRIORITY_NORMAL != nPriority )
{
- if ( THREAD_PRIORITY_ERROR_RETURN == nPriority )
+ if ( THREAD_PRIORITY_ERROR_RETURN == nPriority )
{
Fail ("GetThreadPriority function call failed for %s\n"
"GetLastError returned %d\n", argv[0], GetLastError());
}
- else
+ else
{
Fail ("GetThreadPriority function call failed for %s\n"
"The priority returned was %d\n", argv[0], nPriority);
{
nPriority = 0;
- if (0 == SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST))
+ if (0 == SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST))
{
Fail ("Unable to set thread priority. Either handle doesn't"
" point to current thread \nor SetThreadPriority "
nPriority = GetThreadPriority(hThread);
- if ( THREAD_PRIORITY_ERROR_RETURN == nPriority )
+ if ( THREAD_PRIORITY_ERROR_RETURN == nPriority )
{
Fail ("GetThreadPriority function call failed for %s\n"
"GetLastError returned %d\n", argv[0], GetLastError());
}
- else if ( THREAD_PRIORITY_HIGHEST == nPriority )
+ else if ( THREAD_PRIORITY_HIGHEST == nPriority )
{
Trace ("GetCurrentThread returns handle to the current "
"thread.\n");
exit ( PASS );
- }
- else
+ }
+ else
{
Fail ("Unable to set thread priority. Either handle doesn't"
" point to current thread \nor SetThreadPriority "
#endif
PAL_Terminate();
- return ( PASS );
-
+ return ( PASS );
+
}
** retrieve a handle to itself, and calls GetThreadPriority()
** to verify that its priority matches what it was set to on
** the main execution thread.
-**
+**
**
**===========================================================================*/
{
int priority;
HANDLE hThread;
-
+
/* call GetCurrentThread() to get a pseudo-handle to */
/* the current thread */
hThread = GetCurrentThread();
{
Fail( "GetCurrentThread() call failed\n" );
}
-
-
+
+
/* get the current thread priority */
priority = GetThreadPriority( hThread );
if( priority == THREAD_PRIORITY_ERROR_RETURN )
}
/* store this globally because we don't have GetExitCodeThread() */
- g_priority = priority;
+ g_priority = priority;
return (DWORD)priority;
}
Fail( "ERROR:%lu:SetThreadPriority() call failed\n", GetLastError() );
}
- /* let the child thread run now */
+ /* let the child thread run now */
ResumeThread( hThread );
Fail( "FAIL:Unexpected thread priority %d returned, expected %d\n",
g_priority, THREAD_PRIORITY_TIME_CRITICAL );
}
-#endif
+#endif
PAL_Terminate();
return PASS;