Skip to content

Commit 51bc1ed

Browse files
authored
allow cliloader to proceed in more cases (intel#383)
If the child thread to replace functions cannot be created, we should still continue, since loading the right OpenCL.dll in the child process is usually enough to perform interception.
1 parent eedf0a4 commit 51bc1ed

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

cliloader/cliloader.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -784,18 +784,21 @@ int main(int argc, char *argv[])
784784
NULL );
785785
if( childThread == NULL )
786786
{
787-
die("replacing functions in child thread");
787+
DEBUG("couldn't create child thread to replace functions\n");
788788
}
789-
DEBUG("created child thread to replace functions\n");
790-
791-
// Wait for child thread to complete:
792-
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
789+
else
793790
{
794-
die("waiting for initialization thread");
791+
DEBUG("created child thread to replace functions\n");
792+
793+
// Wait for child thread to complete:
794+
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
795+
{
796+
die("waiting for initialization thread");
797+
}
798+
DEBUG("child thread to replace functions completed\n");
799+
CloseHandle(childThread);
800+
DEBUG("cleaned up child thread to replace functions\n");
795801
}
796-
DEBUG("child thread to replace functions completed\n");
797-
CloseHandle(childThread);
798-
DEBUG("cleaned up child thread to replace functions\n");
799802
}
800803
}
801804

cliprof/cliprof.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -432,18 +432,21 @@ int main(int argc, char *argv[])
432432
NULL );
433433
if( childThread == NULL )
434434
{
435-
die("replacing functions in child thread");
435+
DEBUG("couldn't create child thread to replace functions\n");
436436
}
437-
DEBUG("created child thread to replace functions\n");
438-
439-
// Wait for child thread to complete:
440-
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
437+
else
441438
{
442-
die("waiting for initialization thread");
439+
DEBUG("created child thread to replace functions\n");
440+
441+
// Wait for child thread to complete:
442+
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
443+
{
444+
die("waiting for initialization thread");
445+
}
446+
DEBUG("child thread to replace functions completed\n");
447+
CloseHandle(childThread);
448+
DEBUG("cleaned up child thread to replace functions\n");
443449
}
444-
DEBUG("child thread to replace functions completed\n");
445-
CloseHandle(childThread);
446-
DEBUG("cleaned up child thread to replace functions\n");
447450
}
448451

449452
// Resume child process:

0 commit comments

Comments
 (0)