World: r3wp
[SDK]
older newer | first last |
Geomol 20-Sep-2006 [662] | Louis, yes: http://www.rebol.com/docs/sdk/encap.html |
Louis 20-Sep-2006 [663] | Germol, thanks. I thought I remembered reading that it was possible. I'll read the docs again to figure out how. |
Gabriele 20-Sep-2006 [664] | #include-string and #include-binary are what you are looking for, i think. |
Louis 20-Sep-2006 [665] | Gabriele, thanks. |
Maxim 21-Sep-2006 [666x11] | Gabriele: asynch-call? |
Gabriele, my issue, is that I am trying to capture the output of the applications I call. For this I need to use /console AFAIK. but when I do so, the encapped app just goes mad and enters some kind of deadlock at 100% cpu usage. | |
async-call : WOW ! direct re-implementation using kernel32 lib! | |
I will test using it. the page talks about a polling loop which consumes a lot of cpu... can this be improved (like inserting a wait 0.01) ? | |
anyone tried killing currently running tasks? or now how to? this could be an interesting opportunity for me. | |
about fixing cpu busy look :-) found a working solution. ; wherever you insert the asynch call to system wait list... you also add 0.1 (or any other appropriate value for your app) ; this will obviously quit the event loop immediately. append system/ports/wait-list clist append system/ports/wait-list 0.1 then, where you normally call do-events OR at the end of your app, if not using do-events manually... you put the following: forever [ do-events ] and you have a 0% CPU consuming multiple asynch call loop. I tried with the ping demo provided with async-call and it works perfectly on all the tests I did. | |
The only thing you now need to do is trap an exit condition within your forever loop, otherwise the application runs in the background forever. | |
; something like: if empty? system/view/screen-face/pane [quit] | |
well, I did a little bit more testing and the above procedure does not seem to reduce rebol CPU usage while waiting for calls. but I do have a method which allows you to trade off view interactivity for diminished cpu usage. This obviously also slows down the async calls interactivity, but in most cases, this is not a real concern. | |
here is a new procedure (very effective) append ports: system/ports/wait-list call-ports-list append system/ports/wait-list 0.001 forever [ system/ports/wait-list: [] wait 0.1 system/ports/wait-list: ports do-events if empty? system/view/screen-face/pane [quit] ] | |
but now, the same application (ping-demo) consumes at most 10% activity and often under 5% and there is almost NO discernable difference in view interactivity and overall call feedback ! | |
Gabriele 21-Sep-2006 [677] | Maxim, no, you need /output to capture the output; /console sends the output to the console, but there is no console if you use the cgi option, so probably this does not work correctly. |
Maxim 21-Sep-2006 [678x3] | /output does the same thing |
/wait too. | |
any refinement just makes call in encap go wild (on windows) using dir as the command | |
Gabriele 21-Sep-2006 [681x2] | my async-call function does polling every 0.5 seconds, there is no busy loop like in the original port scheme by Nenad (mine is an improvement over his code). note that it is GPL. (I would be ok with making it BSD, but the original code from Nenad is GPL). it uses timers.r though. |
my version also supports linux, *bsd and mac osx. (osx we have troubles with though, still need to investigate it) | |
Maxim 21-Sep-2006 [683] | if only people would license librairies with LGPL ' :-/ |
Gabriele 21-Sep-2006 [684x2] | of course i also have a kill-process function to kill the process. even on windows. :) |
(i didn't believe it, but windows does not have any way to kill a process - you must create a new thread in that process with a call to ExitProcess... but this only on NT, older wins have no way to do this) | |
Maxim 21-Sep-2006 [686x2] | I know its one of the reasons render farm management apps on windows are sooooo hard to write |
hehe, so where do I get your version of async-call ;-) | |
Gabriele 21-Sep-2006 [688] | you'll have to remove all the Detective dependent parts... then you should ask Nenad if it's ok to use it, unless your app is gpl :) |
Maxim 21-Sep-2006 [689x2] | I might be able to coax him into releasing LGPL? |
regarding your version...I don't mind the work... | |
Dockimbel 21-Sep-2006 [691] | No restriction using my version of async-call, I didn't remember it was GPL, it should be BSD. I'll change that . |
Gabriele 21-Sep-2006 [692x2] | http://www.colellachiara.com/soft/async-call-definition.r |
ah, you're here. the file i had was gpl, let me check... | |
Maxim 21-Sep-2006 [694] | thanks guys :-) |
Gabriele 21-Sep-2006 [695x4] | yep... my file is gpl. it's ok for me to change to bsd too. so you're fine maxim. :) |
timers.r is on http://www.colellachiara.com/soft/libs/ | |
together with other stuff you may need | |
you have some work to do... but it should be a good start. | |
Maxim 21-Sep-2006 [699x2] | Nenad is right, I looked in the release I got (v1.1) and its not gpl. its basicelly BSD. |
wrt stability have you guys encountered any limits or performance instability in some situations so far? | |
Gabriele 21-Sep-2006 [701] | mmm, so probably the version i had - which was much before public release - had no license info, and i assumed gpl since the rest of the detective is gpl. |
Maxim 21-Sep-2006 [702] | Nenad, would you like me to supply the improved ping-demo.r to you? cpu useage is much more reasonable... |
Dockimbel 21-Sep-2006 [703] | I heard once or twice that some exe won't run correctly under asyn-call (freezing or no output). |
Gabriele 21-Sep-2006 [704] | the detective does a lot of calls, and is fine. there are gc bugs in older rebols though. the latest sdk should be fine but i haven't tested it a lot yet. |
Dockimbel 21-Sep-2006 [705] | If the solution is generic, you can send it here: [dockimbel-:-free-:-fr] |
Gabriele 21-Sep-2006 [706] | doc, iirc the cpu problem you had was with using async-modes: 'write, which is a busy loop. am i right? |
Maxim 21-Sep-2006 [707] | yep :-) just a plain drop in replacement to your app. and can be applied to any other app. |
Gabriele 21-Sep-2006 [708] | i'm just doing a poll every 0.5 secs or so. |
Maxim 21-Sep-2006 [709] | but Gabriele might have a better (real) solution |
Gabriele 21-Sep-2006 [710x2] | correction, 0.25 |
using my timers.r, real timers would be much better of course... | |
older newer | first last |