michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * Test whether classic NSPR's select() wrapper properly blocks michael@0: * the periodic SIGALRM clocks. On some platforms (such as michael@0: * HP-UX and SINIX) an interrupted select() system call is michael@0: * restarted with the originally specified timeout, ignoring michael@0: * the time that has elapsed. If a select() call is interrupted michael@0: * repeatedly, it will never time out. (See Bugzilla bug #39674.) michael@0: */ michael@0: michael@0: #if !defined(XP_UNIX) michael@0: michael@0: /* michael@0: * This test is applicable to Unix only. michael@0: */ michael@0: michael@0: int main() michael@0: { michael@0: return 0; michael@0: } michael@0: michael@0: #else /* XP_UNIX */ michael@0: michael@0: #include "nspr.h" michael@0: michael@0: #include michael@0: #include michael@0: #ifdef SYMBIAN michael@0: #include michael@0: #endif michael@0: michael@0: int main(int argc, char **argv) michael@0: { michael@0: struct timeval timeout; michael@0: int rv; michael@0: michael@0: PR_SetError(0, 0); /* force NSPR to initialize */ michael@0: PR_EnableClockInterrupts(); michael@0: michael@0: /* 2 seconds timeout */ michael@0: timeout.tv_sec = 2; michael@0: timeout.tv_usec = 0; michael@0: rv = select(1, NULL, NULL, NULL, &timeout); michael@0: printf("select returned %d\n", rv); michael@0: return 0; michael@0: } michael@0: michael@0: #endif /* XP_UNIX */