mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +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)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
Sleep (microseconds / 1000);
|
||||
/* Round up to the next millisecond */
|
||||
Sleep (microseconds ? (1 + (microseconds - 1) / 1000) : 0);
|
||||
#else
|
||||
struct timespec request, remaining;
|
||||
request.tv_sec = microseconds / G_USEC_PER_SEC;
|
||||
|
@ -247,6 +247,12 @@ test_threaded_weak_ref (void)
|
||||
else
|
||||
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++)
|
||||
{
|
||||
UnrefInThreadData data;
|
||||
|
Loading…
Reference in New Issue
Block a user