SWDEV-286830 - Fix hipStreamACb_ThrdBehaviour on windows
use sleep_for which works cross-platform for other tests as well Change-Id: I915444d620e9fad0b9eda93bcdd244f9956ab8d5
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <hip/hip_runtime.h>
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "test_common.h"
|
||||
#include <atomic>
|
||||
|
||||
@@ -41,7 +38,7 @@ void myCallback(hipStream_t stream, hipError_t status, void* user_data)
|
||||
UserData* data = reinterpret_cast<UserData*>(user_data);
|
||||
printf("Callback started\n");
|
||||
|
||||
sleep(1);
|
||||
std::this_thread::sleep_for (std::chrono::seconds(1));
|
||||
|
||||
printf("Callback ending.\n");
|
||||
gData.store(ExecState::EXEC_CB_FINISHED);
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <chrono>
|
||||
#include <atomic>
|
||||
#include "hip/hip_runtime.h"
|
||||
@@ -80,7 +77,7 @@ static void HIPRT_CB Callback1(hipStream_t stream, hipError_t status,
|
||||
}
|
||||
|
||||
// Delay the callback completion
|
||||
sleep(SECONDS_TO_WAIT);
|
||||
std::this_thread::sleep_for (std::chrono::seconds(SECONDS_TO_WAIT));
|
||||
}
|
||||
|
||||
bool rangedCompare(long a, long b) {
|
||||
|
||||
@@ -27,9 +27,6 @@
|
||||
* HIT_END
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "test_common.h"
|
||||
@@ -41,7 +38,7 @@
|
||||
bool Callback_Completed = false;
|
||||
|
||||
void HIPRT_CB Callback1(hipStream_t stream, hipError_t status, void* userData) {
|
||||
sleep(5);
|
||||
std::this_thread::sleep_for (std::chrono::seconds(5));
|
||||
Callback_Completed = true;
|
||||
}
|
||||
|
||||
@@ -49,7 +46,7 @@ int main(int argc, char* argv[]) {
|
||||
hipStream_t mystream;
|
||||
HIPCHECK(hipStreamCreateWithFlags(&mystream, hipStreamNonBlocking));
|
||||
HIPCHECK(hipStreamAddCallback(mystream, Callback1, NULL, 0));
|
||||
sleep(1);
|
||||
std::this_thread::sleep_for (std::chrono::seconds(1));
|
||||
|
||||
// Callback_Completed is initialized to false. The same is set to true at
|
||||
// the end of callback and callback sleeps for 5 seconds.
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user