os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/tclUnixEvent.c
First public contribution.
4 * This file implements Unix specific event related routines.
6 * Copyright (c) 1997 by Sun Microsystems, Inc.
7 * Portions Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiaries. All rights reserved.
9 * See the file "license.terms" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 * RCS: @(#) $Id: tclUnixEvent.c,v 1.4 2001/11/21 02:36:21 hobbs Exp $
18 *----------------------------------------------------------------------
22 * Delay execution for the specified number of milliseconds.
30 *----------------------------------------------------------------------
35 int ms; /* Number of milliseconds to sleep. */
38 Tcl_Time before, after;
41 * The only trick here is that select appears to return early
42 * under some conditions, so we have to check to make sure that
43 * the right amount of time really has elapsed. If it's too
44 * early, go back to sleep again.
50 after.usec += (ms%1000)*1000;
51 if (after.usec > 1000000) {
52 after.usec -= 1000000;
56 delay.tv_sec = after.sec - before.sec;
57 delay.tv_usec = after.usec - before.usec;
58 if (delay.tv_usec < 0) {
59 delay.tv_usec += 1000000;
64 * Special note: must convert delay.tv_sec to int before comparing
65 * to zero, since delay.tv_usec is unsigned on some platforms.
68 if ((((int) delay.tv_sec) < 0)
69 || ((delay.tv_usec == 0) && (delay.tv_sec == 0))) {
73 (void) select(0, NULL, NULL,
76 (void) select(0, (SELECT_MASK *) 0, (SELECT_MASK *) 0,
77 (SELECT_MASK *) 0, &delay);*/