Changes
Page history
Make the code to sleep cross platform
authored
Jan 31, 2024
by
Pier Angelo Vendrame
Hide whitespace changes
Inline
Side-by-side
Updating.md
View page @
28a17cc3
...
@@ -284,9 +284,12 @@ If you are on Windows, you can add a `__debugbreak();` line, and you will be abl
...
@@ -284,9 +284,12 @@ If you are on Windows, you can add a `__debugbreak();` line, and you will be abl
However, if you can't debug it, there is no way to resume the updater.
However, if you can't debug it, there is no way to resume the updater.
A similar approach is to add some sleep, whose value depends on an environment variable.
A similar approach is to add some sleep, whose value depends on an environment variable.
For example
, this will work on Windows
:
For example:
```
c++
```
c++
#include
<thread>
int
NS_main
(
int
argc
,
NS_tchar
**
argv
)
{
const
char
*
shouldDelay
=
getenv
(
"TBB_UPDATER_DELAY"
);
const
char
*
shouldDelay
=
getenv
(
"TBB_UPDATER_DELAY"
);
if
(
shouldDelay
)
{
if
(
shouldDelay
)
{
char
*
endptr
;
char
*
endptr
;
...
@@ -294,7 +297,7 @@ For example, this will work on Windows:
...
@@ -294,7 +297,7 @@ For example, this will work on Windows:
if
(
endptr
==
shouldDelay
)
{
if
(
endptr
==
shouldDelay
)
{
d
=
60
;
d
=
60
;
}
}
Sleep
(
d
*
1000
);
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
d
)
);
}
}
```
```
...
...
...
...