> i understand the reason for it, but before i go adding this to my storage > API i just wanted to ask for some opinions as to whether this approach is > generically both technically and philosophically sound, or whether the fact > that it works at all relies on other voodoo deep within os_unix.
There's no voodoo in this approach. Look at it from the other point of view. If your library needs to write exactly n bytes but write() returned that it has written m bytes which is less than n what will you do? You will do the same approach - simple retry. Both situations (with signal interruption and with incomplete write) mean the same - there was no error of any kind, just technically write() wasn't able to proceed. BTW, if signal will interrupt write() after it has written part of the data already you won't get EINTR, you will get successful result just with amount written less than you asked for. Pavel On Thu, Aug 18, 2011 at 10:46 AM, Stephan Beal <sgb...@googlemail.com> wrote: > On Thu, Aug 18, 2011 at 4:39 PM, Pavel Ivanov <paiva...@gmail.com> wrote: > >> If you don't want your library behavior to be changed when process >> receives some signals then you have to use such or some similar >> approach. >> > > i understand the reason for it, but before i go adding this to my storage > API i just wanted to ask for some opinions as to whether this approach is > generically both technically and philosophically sound, or whether the fact > that it works at all relies on other voodoo deep within os_unix. > > The main thing that troubles me is that this approach just seems "too easy" > given this particular problem, and i'm suspicious because of that. It > _seems_ to be exactly what i'm looking for, but i also know that my > knowledge for the effect of EINTR on system calls is too constrained for me > to have my own educated, confident opinion on it. > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users