r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Extensions] REBOL 3 Extensions discussions

Graham
20-Jul-2010
[1199]
( Unless QT is wrapped .. like AGG is )
Carl
20-Jul-2010
[1200]
So, you could use a socket or IPC, etc.
BrianH
20-Jul-2010
[1201]
You probably can't wrap Qt like AGG. It would be easier to wrap R3.
Graham
20-Jul-2010
[1202]
Isn't Rebol blocked by the extension though?
AdrianS
20-Jul-2010
[1203]
don't know if this has been discussed wrt callbacks, but it would 
be good to be able to call back into REBOL for purposes of controlling 
execution, say for debugging from a non REBOL editor/IDE
Carl
20-Jul-2010
[1204]
That's more of a reverse callback, right?
AdrianS
20-Jul-2010
[1205]
yes
Carl
20-Jul-2010
[1206]
I think we'll want to do that to some extent.
Graham
20-Jul-2010
[1207]
So, all the examples I've seen that I remember .. Rebol executes 
an imported function...and control returns Rebol.
Carl
20-Jul-2010
[1208]
Graham, if it's a task (OS thread), then no, it's not blocked and 
has its own stack.
Graham
20-Jul-2010
[1209]
But we can't do that at present ... start a thread to call our extension
BrianH
20-Jul-2010
[1210]
I am having a slight policy problem with the delayed module model, 
which could some feedback.
Carl
20-Jul-2010
[1211x2]
Callbacks work both ways, which has been my point for a whle now. 
But, we'll need to know what we want.
G: why not?
Graham
20-Jul-2010
[1213]
Maybe it's the documentation I haven't read yet??
Carl
20-Jul-2010
[1214]
B: what's the policy problem?
AdrianS
20-Jul-2010
[1215]
kind of similar to Graham's request, but for use with WebKit running 
as an extension - it would be nice to be able to send DOM events 
back to REBOL - would this need the same kind of mechanism as with 
QT?
Carl
20-Jul-2010
[1216]
What we probably should do is designate a PORT type for intertask 
messaging, and make it easy to use.
Graham
20-Jul-2010
[1217]
a Rrexx port
Carl
20-Jul-2010
[1218]
Sort of... they were originally based on Amiga Ports. History.
BrianH
20-Jul-2010
[1219]
If you are adding a module to the module list, and there is an existing 
module of that name, then the new module either overrides it, replaces 
it, or doesn't get added (possibly with an error triggered, but so 
far not). The question is which one to do in the particular circumstances. 
The factors are whether it is the same module, for whatever "same" 
means here considering it might be reloaded or still source; whether 
the versions are the same or greater; whether the existing module 
has already been made or is still source, and the same for the module 
to be added.
Carl
20-Jul-2010
[1220]
This is going to take some discussion. Probably not here in this 
group, because it may get rather long.
BrianH
20-Jul-2010
[1221]
I started in the other world. We can pick up there when you like.
Carl
20-Jul-2010
[1222]
Probably best. But, there are also various notes here too I see.
Graham
20-Jul-2010
[1223x2]
simple example 

view [ button "Print" print "hello" button "QT" do [ test ]]


when I click on the QT button, I bring up a QT window but event processing 
stops on the Rebol side .. the Print button no longer responds
all the test function does is open up a qt window with a button and 
starts qts event handler
Andreas
21-Jul-2010
[1225]
quick heads up: I built A101 just fine (a Win32 build cross-compiled 
on Linux) and the "go.r" demo still works. so thanks for A101, Carl!
Graham
21-Jul-2010
[1226]
So, the go.r demo is a heads up display?
Maxim
21-Jul-2010
[1227x3]
the main difference between a message based callback and function 
stack callback are in synchronisation and locking.


they both have advantages, but many libraries require function stack 
callbacks.
the main disadvantage of these is that they block, but usually that's 
because the data has to be locked anyways while some code reliquishes 
control
Brian, my callbacks are thread safe in regards to tasks and threads 
(I read extensively on the subject when I did my hack).


but I talked with Carl, and in fact they are not safe within a single 
process to begin with
BrianH
21-Jul-2010
[1230]
Be sure to talk it over with Carl tomorrow. We will be coordinating 
on module stuff.
Maxim
21-Jul-2010
[1231x2]
the way I see it is that for callbacks to be safe, the GC has to 
be momentarily locked.  otherwise memory swapping might occur within 
the core which isn't synchronised in the command (you get some pointers 
from the core) and those pointers might not exist anymore when the 
callback returns.
so you end up changing memory which has been recycled and asking 
for trouble.
BrianH
21-Jul-2010
[1233]
Plus there are changes that could be happening in other tasks in 
R3 as well.
Maxim
21-Jul-2010
[1234x2]
to make it work, carl would have to make a purpose-built C function 
which makes sure that memory used by a command is safely preserved 
for the length of the command, or something like that.
yes, shared memory with threads (if this is how R3 currently does 
it) always requires some form of locking.


again, the GC would need to cooperate in this process... maybe having 
explicit locking or semaphores, just like the Amiga did it.
BrianH
21-Jul-2010
[1236x2]
We have a task! type now, and have had it for a while. It doesn't 
work well but when last I checked it does work. Of course none of 
the system supports its use, and error handling in a task will crash 
R3, but that all is fixable.
I am hoping for a certain level of non-shared memory and intertask 
communication, but we'll have to see how much we can get away with.
Maxim
21-Jul-2010
[1238x3]
yes this has to be there for safe multithreading.
if the core where based on copy on set then it would be pretty safe, 
but alas, we have mutable series.
I'd build a device model for the tasks, this way it would be async. 
 just don't inlude stupid OS based limitatios like in python, where 
the thread which creates a thread, has no way of forcefull closing 
it.  so if a tread hangs.  your whole app can hang with it.  :-(
BrianH
21-Jul-2010
[1241x3]
Tssk-local on set?
Task-local
Kind of a linear thing. If a task takes ownership, it becomes copy-on-write 
for other tasks.
Maxim
21-Jul-2010
[1244x2]
internally that can work, but the issue arises when two threads share 
a series. if they write at the same time, even with a copy, things 
like indexes might not update atomically to the copy operation.
its the same issue we have with commands and callbacks... there is 
no data "ownership" AFAICt.
BrianH
21-Jul-2010
[1246]
That is the kind of thing that we should avoid. As it is, system/contexts/user 
is supposed to be task-local. Getting the rest of the functions so 
they aren't self-modifying shouldn't be difficult, especially since 
I have been keeping that in mind when I work over the mezzanines.
Maxim
21-Jul-2010
[1247x2]
the way I see it, when a thread is launched, it should Copy the whole 
environment and become completely independent.  data exchange between 
tasks is done explicitely, and no GC allocated data should be able 
to cross thread boundaries.  obviously using external libs you may 
have some fun, but then its OS allocated and not managed by the core, 
so its your call.
utility functions like  synchronise would be nice. but they would 
be something you call manually.   I find its always better when the 
code actually implements the paradigm, rather than trying to hide 
it.   a bit like Apple's GDC.  you explicitely create little tasks 
which you launch and wait for completion.  its simple, obvious and 
highly scalable.