Re: SIGALRM in a class member?
On Aug 14, 12:38 am, Ron Eggler <unkn...@example.com> wrote:
I also replaced my atoi(string from XML parser) to this:
istringstream buffer(INITSource::XMLread(inBufstr,"Cyclic"));
buffer >> HeartBeatTime;
HeartBeatTime=float(float(HeartBeatTime)/100*90);
alarm(HeartBeatTime);
What do you think to this, is this better?
If it is in a signal handler, it's undefined behavior.
This should work properly as well and is C++ conform, any
other suggestions or hints regarding this conversion?
You can't do anything this complicated in a signal handler
without incurring undefined behavior.
Note that C++ is even trickier with regards to signal handlers,
since Posix makes no guarantees concerning C++. In general, you
can count on being able to do anything you could do from a
signal handler in C, but nothing more. You cannot do *anything*
which uses any of the iostream stuff, or FILE*. You cannot call
any of the functions defined in the C++ standard. Of the
functions defined in the C standard, I think time(), rename(),
signal() and abort() are the only ones allowed (unless I've
missed one).
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34