From: <pmo...@us...> - 2003-10-17 21:05:48
|
Update of /cvsroot/aolserver/aolserver/nsd In directory sc8-pr-cvs1:/tmp/cvs-serv2035 Modified Files: tcljob.c Log Message: I fixed bug with the -timeout option for wait and waitany. I was passing relative time instead of absolute time and this caused pthread_cond_timedwait to return "EINVAL". Index: tcljob.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tcljob.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcljob.c 14 Oct 2003 01:29:50 -0000 1.22 --- tcljob.c 17 Oct 2003 21:04:53 -0000 1.23 *************** *** 560,563 **** --- 560,564 ---- Ns_Time timeout; int timedOut = 0; + long sec, milliSec; argIndex = 2; *************** *** 571,583 **** timeoutFlag = 1; if ((Tcl_GetLongFromObj(interp, objv[argIndex++], ! &timeout.sec) != TCL_OK) || (Tcl_GetLongFromObj(interp, objv[argIndex++], ! &timeout.usec) != TCL_OK)) { return TCL_ERROR; } /* ! * Convert the specified milliseconds to microseconds. */ ! timeout.usec *= 1000; } } --- 572,586 ---- timeoutFlag = 1; if ((Tcl_GetLongFromObj(interp, objv[argIndex++], ! &sec) != TCL_OK) || (Tcl_GetLongFromObj(interp, objv[argIndex++], ! &milliSec) != TCL_OK)) { return TCL_ERROR; } + /* ! * Set the timeout time. This is an absolute time. */ ! Ns_GetTime(&timeout); ! Ns_IncrTime(&timeout, (time_t)sec, (milliSec * 1000)); } } *************** *** 723,726 **** --- 726,730 ---- Ns_Time timeout; int timedOut = 0; + long sec, milliSec; argIndex = 2; *************** *** 734,746 **** timeoutFlag = 1; if ((Tcl_GetLongFromObj(interp, objv[argIndex++], ! &timeout.sec) != TCL_OK) || (Tcl_GetLongFromObj(interp, objv[argIndex++], ! &timeout.usec) != TCL_OK)) { return TCL_ERROR; } /* ! * Convert the specified milliseconds to microseconds. */ ! timeout.usec *= 1000; } } --- 738,751 ---- timeoutFlag = 1; if ((Tcl_GetLongFromObj(interp, objv[argIndex++], ! &sec) != TCL_OK) || (Tcl_GetLongFromObj(interp, objv[argIndex++], ! &milliSec) != TCL_OK)) { return TCL_ERROR; } /* ! * Set the timeout time. This is an absolute time. */ ! Ns_GetTime(&timeout); ! Ns_IncrTime(&timeout, (time_t)sec, (milliSec * 1000)); } } |