1. request for function: interrupts
- Posted by useless_ Jan 01, 2013
- 1012 views
From irc, for public evaluation and consideration:
[16:13] <CoJaBo> m_m: The biggest problem you'll probably run into is the lack of any support for time limits; if your code gets stuck in a loop it will DoS the server and bring it down. [16:17] * any25596957 will include code in loops that says :: if ((time() - starttime) > allowedtime) then exit/goto/quit/abort/die end if [16:17] <any25596957> because any and all internet apps can and do hang at the worst times [16:18] <CoJaBo> yeh, but you'd need to add that to EVERY loop for it to work; even the std libs. and that's assuming you don't hit interpreter hangs.. [16:19] * any25596957 nods [16:19] <CoJaBo> it'd need to be a built-in [16:20] <any25596957> an interruptable Euphoria [16:20] <any25596957> on timertick do {list of routines to check for user-supplied timeout}Nope, no wordwrap in <pre></pre> tags in creole.
useless
2. Re: request for function: interrupts
- Posted by jimcbrown (admin) Jan 01, 2013
- 987 views
From irc, for public evaluation and consideration:
[16:13] <CoJaBo> m_m: The biggest problem you'll probably run into is the lack of any support for time limits; if your code gets stuck in a loop it will DoS the server and bring it down. [16:17] * any25596957 will include code in loops that says :: if ((time() - starttime) > allowedtime) then exit/goto/quit/abort/die end if [16:17] <any25596957> because any and all internet apps can and do hang at the worst times [16:18] <CoJaBo> yeh, but you'd need to add that to EVERY loop for it to work; even the std libs. and that's assuming you don't hit interpreter hangs.. [16:19] * any25596957 nods [16:19] <CoJaBo> it'd need to be a built-in [16:20] <any25596957> an interruptable Euphoria [16:20] <any25596957> on timertick do {list of routines to check for user-supplied timeout}Nope, no wordwrap in <pre></pre> tags in creole.
This should really be a Request-for-Feature ticket, but the main problem with this simply that it's hard to do. A lot of machine funcs/procs and a lot of builtin routines call C functions that don't return in a set time period (e.g. system() ) and the underlying C library doesn't provide a way to interrupt them.
This could be done with pre-emptive multithreading, but Euphoria doesn't have that yet.
The backend could work around the issues with the underlying C library by using threads, but since the backend isn't thread safe yet this might be a long way from being a practical approach.
The only other option, if 100% Euphoria is desired, is to use multiple processes. The ability to use fork() makes this a lot easier (only one actual program is needed, and child processes to do blocking operations automatically inherit all the variables from the parent process), but on Windoze you'd probably have to write separate programs for the blocking operations as well as a master program to be the server application.