|
|
Choosing A Webhost: |
Re: cancel and timeout: msg#00133db.tds.freetds
On Thu, 20 Jan 2005 17:11:12 -0000, "Thompson, Bill D (London)" <bill_d_thompson@xxxxxx> wrote: > > Timeout > > ------- > > Now if a timeout (now query_timeout) a query_timeout_func it's called. > I > > removed chkintr and hndlintr (one function it's sufficient). > > query_start_time it's use for global time counting. I don't know if > > query timeout on dblib works as expected. Perhaps even SQLFetch or > > similar need setting timeout. > > I think there are two functions because this then mirrors the dblibrary > interrupt handlers. Thanks for tackling this, Freddy. I think Bill means: void dbsetinterrupt(dbproc, chkintr, hndlintr) DBPROCESS *dbproc; int (*chkintr)(); int (*hndlintr)(); http://sybooks.sybase.com/onlinebooks/group-cnarc/cng1000e/dblib/@Generic__BookTextView/34848;pt=34848;uf=0#X Note the comment: "DB-Library does non-blocking reads from the server. While waiting for a read from the server, it will call the chkintr() function to see if an interrupt is pending. If chkintr() returns TRUE and a handler has been installed as the hndlintr() for dbsetinterrupt, hndlintr() will be called." That's not how dblib_query_timeout() is currently coded. chkintr should be called periodically from within src/tds/net.c::goodread() until either: 1. the server sends data, or 2. the query_timeout expires. goodread() calls hndlintr after the timeout. It should call it while counting down to the timeout. How often? The docs don't say. They say they (Sybase) do non-blocking I/O, implying a busy wait. I think it would be OK to call select(2) with a timeout of, say, 100 ms (blocking), then call hndlintr, then busyfunc, then deduct 100 ms from query_timeout, and call select(2) again. Something like: for (ti = selecttimeout; retcode = select(tds->s + 1, &fds, NULL, NULL, ti); ti.tv_usec -= 100) { if (retcode < 0) { /* error */ } if (retcode > 0) { break; /* data ready: read */ } assert(retcode == 0); /* partial timeout */ if (ti.tv_usec < 0) { ti.tv_sec--; ti.tv_usec += 1000; } if (ti.tv_sec < 0) break; /* really timed out */ if ((*tds->chkintr)()) (*tds->hndlintr()); if (tds->busyfunc) (*tds->busyfunc)(); } len = READSOCKET(tds->s, buf + got, buflen); if (tds->idlefunc) (*tds->idlefunc)(); These may also be interesting: dbsetidle: http://sybooks.sybase.com/onlinebooks/group-cnarc/cng1000e/dblib/@Generic__BookTextView/34650;pt=3564 "idlefunc() will be automatically called whenever DB-Library has finished reading output from the server." dbsetbusy: http://sybooks.sybase.com/onlinebooks/group-cnarc/cng1000e/dblib/@Generic__BookTextView/34263;pt=34263;uf=0#X "automatically called whenever DB-Library is reading or waiting to read output from the server." --jkl
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ freetds-Patches-602086 ] Sybase DB-Lib ABI compatibility, SourceForge.net |
|---|---|
| Next by Date: | [ freetds-Patches-1106465 ] quote column names for bcp, SourceForge.net |
| Previous by Thread: | RE: cancel and timeout, Thompson, Bill D (London) |
| Next by Thread: | RE: cancel and timeout, Thompson, Bill D (London) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |