?? readme
字號(hào):
/* * POSIX.1 Signals * * Written by J. Vidal * Copyright (C) Dec, 2002 OCERA Consortium. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2. * * Programs to test POSIX.1 signals implementation. * */Test programsIn this directory , there is a nice collection of 20 test programs, distributed in separated directories. To load any test program, type make test in the correspondent directory. In the following list, a brief description of each one, is provided:hello.c: This is a trivial program in which a periodic thread sends a signal to itself every time a condition is acomplished. The signal handler for that signal prints a message saying ``Hello world! Signal handler called for signal ...'' signals.c: This is a test program in which there is a master thread and a user defined number of slaves. The master thread is the only thread that is periodic. It sends a signal to each slave in each activation. Slaves are suspended and waked up by it's signal handler. After reciving a number of signals, the slave thread blocks that signal with pthread_sigmask. After this no more signals are delivered.wait_4_sig.c: In this program, we prove most of implemented functionalities: pthread_sigmask, sigsuspend, pthread_kill, terminating threads from signal handlers, blocked mask ... The logic of the program consists in a master that is sending a window of signals to a slave. Slave blocks all signals each time except the one that they want to receive for that moment. Only the handler for the signal that is unblocked will be executed. The other signals generated don't have effect so they are blocked.signals.c: This is a test program in which there is a master thread and a user defined number of slaves. The master thread is the only thread that is periodic. It sends a signal to each slave in each activation. Slaves are suspended and waked up by it's signal handler. After reciving a number of signals, the slave thread blocks that signal with pthread_sigmask. After this no more signals are delivered.ign_signals.c: In this test a master sends signals to all its slaves. Only odd threads should get delivered generated signals. So the others threads have installed the default handler or SIG_IGN.test.c: This is a simple program to test that the execution of a signal handler can be interrumpted by other higher priority threads. In this test two periodic threads are wasting time when they execute its signal handler. Be careful with the amount of computing they do in its signal handlers. They can hang up slow processors. A hight priority thread expulses signal handler executions periodically every 1 milisecond. Also a higher priority signal handler expulses a lower. A chronogram of what its happening is shown in file testlog.txt. The first task is linux. The second and the third are periodic tasks that are executing huge quantity of computing on their signal handlers. Last task is a high frequency periodic task. Finally, priority is increassing with the number of the task. This is, the first task the less prioritary, the last the most.sig_intr.c: This program shows what happens when a non periodic thread it's executing a handler and is interrumped by other hight priority thread.ign_signals.c: In this test a master sends signals to all its slaves. Only odd threads should get delivered generated signals. So the others threads have installed the default handler or RTL_SIG_IGN. sig_prio.c: In this program a thread sends a signal to a higher priority thread. At this moment the higher priority thread should take the CPU. Then it suspends signal generator to prove that has taken the CPU.sig_nanosleep.c: In this program a thread is sleeping for a while. While it is sleeping other thread generates a signal for it. Then the thread is interrumped and shows the sleep time remained. sched.c: This program implements a very simple version of the round robin scheduler using a periodic thread and user signals. Each scheduled thread has three signal handlers: the first suspends that thread while the second wake ups it. Finally the third finishes it. The periodic thread has a handler that implements the scheduling algorithm. Each time it has to schedule sends a signal to itself. Then the handler for that signal sends a signal to suspend the current thread and other to wake up next thread. Finally, when the scheduler finishes sends a signal to kill all the scheduled threads. sig_sem.c: In this program, various threads are blocked on a semaphore. While they are blocked other thread generates a signal to no odd semaphore blocked threads. Then no odd threads are interrumped and gets out the semaphore. The other threads remain blocked.Note: There is also, a test version for timed semaphores on file sig_timedsem.csig_mutex.c: In this program, various threads are blocked on a mutex. While they are blocked on the mutex, the master threads sends signals to them. At this point blocked threads must execute the signal handler and remain blocked.Note: There is also, a test version for timed mutexes on file sig_timedmutex.c.sig_condvar.c: In this program a real-time thread before becoming blocked on a condition variable sends a signal to itself. After becoming blocked it executes the signal handler for previous generated signal. After this, it resumes blocked on the condition variable.pending.c: Simple program to test signal delivery order and global sigactions.posixtestsuite: In this directory you will find three test program testing sigaction functionality.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -