mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-28 02:20:04 +01:00
Merge branch 'win32-usleep-ceil' into 'master'
g_usleep: round up the next millisecond on Windows. See #1371 See merge request GNOME/glib!24
This commit is contained in:
commit
a431f4fe3e
@ -251,7 +251,8 @@ void
|
|||||||
g_usleep (gulong microseconds)
|
g_usleep (gulong microseconds)
|
||||||
{
|
{
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
Sleep (microseconds / 1000);
|
/* Round up to the next millisecond */
|
||||||
|
Sleep (microseconds ? (1 + (microseconds - 1) / 1000) : 0);
|
||||||
#else
|
#else
|
||||||
struct timespec request, remaining;
|
struct timespec request, remaining;
|
||||||
request.tv_sec = microseconds / G_USEC_PER_SEC;
|
request.tv_sec = microseconds / G_USEC_PER_SEC;
|
||||||
|
@ -247,6 +247,12 @@ test_threaded_weak_ref (void)
|
|||||||
else
|
else
|
||||||
n = NUM_COUNTER_INCREMENTS / 20;
|
n = NUM_COUNTER_INCREMENTS / 20;
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
/* On Windows usleep has millisecond resolution and gets rounded up
|
||||||
|
* leading to the test running for a long time. */
|
||||||
|
n /= 10;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
UnrefInThreadData data;
|
UnrefInThreadData data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user