I try to answer your question.
In my understanding, you are asking for a way to deal with a signal
interrupt in an interpreted C/C++ code. You can do that as follows.
Cint supports ANSI C interrupt signals. You can use signal() and raise()
functions as follows. For example, if you use SIGINT
interpreted.C------------------------------
#include <signal.h>
#include <stdio.h>
void gotsignal() { // Must be interpreted. Precompiled func can not be used
printf("I got a signal\n");
signal(SIGINT,gotsignal);
}
main() {
signal(SIGINT,gotsignal); // interpreted signal() must get interpreted
// function as 2nd arg
// something
raise(SIGINT); // interpreted raise works fine, gotsignal is called
// do something
my_raise(SIGINT); // compiled raise works fine, gotsignal is called
// do something
for(;;) {
// do something
// if raise(SIGINT) is called within this loop or somewhere,
// in the system gotsignal() is called.
}
}
compiled.C-----------------------------------
#include <signal.h>
void my_raise() {
raise(SIGINT); // compiled raise
}
Limitation here is as follows,
* If signal function is interpreted, you must give interpreted function
as 2nd argument.
* If signal function is compiled, you must give compiled function
as 2nd argument.
raise function is compatible in both cases.
Cint , standalone, supports following type of signals.
SIGINT
SIGILL
SIGFPE
SIGABRT
SIGSEGV
SIGTERM
I'm not sure using above signal handler creates problem in other part of
ROOT system.
Masaharu Goto
> Hello ROOTers,
>
> in developing our system in ROOT we reach the point when we need
> to get data over network asynchronously. Whole the existing system is
> written using CINT macros & our version of ROOT interpreter with
> network extension allowing sending & receiving of data in compatible way
> with our existing applications. The question is if we can setup
> a signal handler in CINT macro and in the handler to receive data.
> Is there any way to do this ?
>
> Radovan