I am looking at the stubs generated using Cstubs_inverted and I am wondering to what extent these stubs are usable when used in the context of a multi-threaded application.
Here is a typical stub generated:
unsigned long C_Initialize(void* x1)
{
enum { nargs = 1 };
CAMLparam0();
CAMLlocalN(locals, nargs);
locals[0] = CTYPES_FROM_PTR(x1);
value x2 = functions[fn_C_Initialize];
value x3 = caml_callbackN(x2, nargs, locals);
unsigned long x4 = ctypes_ulong_val(x3);
CAMLreturnT(unsigned long, x4);
}
What could be really nice is to have support in the inverted stub mechanisms to be able to insert arbitrary code at the very beginning of that function, and just before the return. We were able to simulate that behavior by patching memory.h (a dirty hack) but this is in no way satisfying. With these hooks in place, it should be possible to put some sane locking in place. Does it make sense? Is it compatible with the kind of customatization you had in mind for #197?
I am looking at the stubs generated using
Cstubs_inverted
and I am wondering to what extent these stubs are usable when used in the context of a multi-threaded application.Here is a typical stub generated:
What could be really nice is to have support in the inverted stub mechanisms to be able to insert arbitrary code at the very beginning of that function, and just before the return. We were able to simulate that behavior by patching
memory.h
(a dirty hack) but this is in no way satisfying. With these hooks in place, it should be possible to put some sane locking in place. Does it make sense? Is it compatible with the kind of customatization you had in mind for #197?