Skip to content

Commit

Permalink
allow cliloader to proceed in more cases (#383)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bashbaug authored Oct 26, 2024
1 parent eedf0a4 commit 51bc1ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
21 changes: 12 additions & 9 deletions cliloader/cliloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,18 +784,21 @@ int main(int argc, char *argv[])
NULL );
if( childThread == NULL )
{
die("replacing functions in child thread");
DEBUG("couldn't create child thread to replace functions\n");
}
DEBUG("created child thread to replace functions\n");

// Wait for child thread to complete:
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
else
{
die("waiting for initialization thread");
DEBUG("created child thread to replace functions\n");

// Wait for child thread to complete:
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
{
die("waiting for initialization thread");
}
DEBUG("child thread to replace functions completed\n");
CloseHandle(childThread);
DEBUG("cleaned up child thread to replace functions\n");
}
DEBUG("child thread to replace functions completed\n");
CloseHandle(childThread);
DEBUG("cleaned up child thread to replace functions\n");
}
}

Expand Down
21 changes: 12 additions & 9 deletions cliprof/cliprof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,18 +432,21 @@ int main(int argc, char *argv[])
NULL );
if( childThread == NULL )
{
die("replacing functions in child thread");
DEBUG("couldn't create child thread to replace functions\n");
}
DEBUG("created child thread to replace functions\n");

// Wait for child thread to complete:
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
else
{
die("waiting for initialization thread");
DEBUG("created child thread to replace functions\n");

// Wait for child thread to complete:
if( WaitForSingleObject(childThread, INFINITE) != WAIT_OBJECT_0 )
{
die("waiting for initialization thread");
}
DEBUG("child thread to replace functions completed\n");
CloseHandle(childThread);
DEBUG("cleaned up child thread to replace functions\n");
}
DEBUG("child thread to replace functions completed\n");
CloseHandle(childThread);
DEBUG("cleaned up child thread to replace functions\n");
}

// Resume child process:
Expand Down

0 comments on commit 51bc1ed

Please sign in to comment.