/* Copyright 2005 Intel Corporation. All rights reserved. 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 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. The full GNU General Public License is included in this distribution in the file called LICENSE. */ #include #include #include #include #include static atomic_t sem_test_nr_threads = ATOMIC_INIT(0); static atomic_t sem_test_threads_done = ATOMIC_INIT(0); static atomic_t sem_test_failures = ATOMIC_INIT(0); static int delay_count = 100, repeat_count = 1000, thread_count = 5; static int sem_test_go, sem_test_abort; static char pad1[128] = "foo"; static struct semaphore sem_test_semaphore; static int owner = -1; static char pad2[128] = "bar"; static int sem_test_thread(void *dummy) { int our_nr = (long)dummy; int i, good = 0; while (!sem_test_go) { if (sem_test_abort) { atomic_inc(&sem_test_failures); return 1; } schedule(); } for (i=0; i"); module_param(delay_count, int, 0); module_param(repeat_count, int, 1000); module_param(thread_count, int, 2);