Форум » RusXMMS Project » Gentoo & XMMS » Ответить

Gentoo & XMMS

darksoft: Нашел таки почему в Gentoo xmms по Ctrl+C падает. Они специально для это замечательный патчик написали: 0040_all_sigterm.patch: цитата void sigterm_handler(int sig) { /* xmms_remote_quit(ctrlsocket_get_session_id()); */ mainwin_quit_cb(); } mainwin_quit_cb() понятное дело вызывает кучу всяких разных функций. Большая часть из них, разумеется, не async safe. А я удивляюсь чего это в Gentoo xmms падает... И ведь кто-то писал патч, и кто-то его принимал.... А тем временем в умных книжках про обработчики сигналов написано следующее: цитата Recall that a function is async-signal safe if it can be safely called from with in a signal handler. Many POSIX library functions are not async-signal safe beca use they use static data structures, call malloc or free, or use global data str uctures in a nonreentrant way. Consequently, a single process might not correctl y execute concurrent calls to these functions. Normally this is not a problem, but signals add concurrency to a program. Since signals occur asynchronously, a process may catch a signal while it is executing a library function. (For example, suppose the program interrupts a strtok call and executes another strtok in the signal handler. What happens when the first c all resumes?) You must therefore be careful when calling library functions from inside signal handlers. (C) Unix Systems Programming. Communication, Concurrency, and Threads by Prentice Hall Более того: цитата Handlers that return normally must modify some global variable in order to have any effect. Typically, the variable is one that is examined periodically by the program during normal operation. Its data type should be sig_atomic_t. (C) The GNU C Library - Signal Handling Вот такая вот фигня. Завтра завтра выложу патч к патчу ;))))

Ответов - 0



полная версия страницы