Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * Test whether classic NSPR's select() wrapper properly blocks
8 * the periodic SIGALRM clocks. On some platforms (such as
9 * HP-UX and SINIX) an interrupted select() system call is
10 * restarted with the originally specified timeout, ignoring
11 * the time that has elapsed. If a select() call is interrupted
12 * repeatedly, it will never time out. (See Bugzilla bug #39674.)
13 */
15 #if !defined(XP_UNIX)
17 /*
18 * This test is applicable to Unix only.
19 */
21 int main()
22 {
23 return 0;
24 }
26 #else /* XP_UNIX */
28 #include "nspr.h"
30 #include <sys/time.h>
31 #include <stdio.h>
32 #ifdef SYMBIAN
33 #include <sys/select.h>
34 #endif
36 int main(int argc, char **argv)
37 {
38 struct timeval timeout;
39 int rv;
41 PR_SetError(0, 0); /* force NSPR to initialize */
42 PR_EnableClockInterrupts();
44 /* 2 seconds timeout */
45 timeout.tv_sec = 2;
46 timeout.tv_usec = 0;
47 rv = select(1, NULL, NULL, NULL, &timeout);
48 printf("select returned %d\n", rv);
49 return 0;
50 }
52 #endif /* XP_UNIX */