AuthorTopic
administrator


link post  Posted: 29.12.05 07:19. Post subject: Gentoo & XMMS


Нашел таки почему в 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 
ProfileQuote Reply
No new replys


Reply:
1 2 3 4 5 6 7 8 9
большой шрифт малый шрифт надстрочный подстрочный заголовок большой заголовок видео с youtube.com картинка из интернета картинка с компьютера ссылка файл с компьютера русская клавиатура транслитератор  цитата  кавычки моноширинный шрифт моноширинный шрифт горизонтальная линия отступ точка LI бегущая строка оффтопик свернутый текст

показывать это сообщение только модераторам
не делать ссылки активными
Username, Password:      register    
Тему читают:
- user online
- user offline
All times are GMT  4 Hours. Hits today: 1
You can: smiles yes, images yes, types yes, poll no
avatars yes, links on, premoderation off, edit new post no