X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=formal-model%2Ffutex-wakeup%2Ffutex.spin;fp=formal-model%2Ffutex-wakeup%2Ffutex.spin;h=0000000000000000000000000000000000000000;hb=5e32821aa6d74b755730c19a8aa66404d2c367c9;hp=5459a537b8f4b14f76bdde80eb8dddeb77548e2a;hpb=41e967af0a4bd23a88b87be39a6c7f7d68a9e2ca;p=urcu.git diff --git a/formal-model/futex-wakeup/futex.spin b/formal-model/futex-wakeup/futex.spin deleted file mode 100644 index 5459a53..0000000 --- a/formal-model/futex-wakeup/futex.spin +++ /dev/null @@ -1,124 +0,0 @@ -/* - * futex.spin: Promela code to validate futex wakeup algorithm. - * - * Algorithm verified : - * - * queue = 0; - * fut = 0; - * runvar = 0; - * - * Waker - * queue = 1; - * if (fut == -1) { - * fut = 0; - * } - * - * Waiter - * while (1) { - * progress: - * fut = fut - 1; - * if (queue == 1) { - * fut = 0; - * } else { - * if (fut == -1) { - * while (fut == -1) { } - * } - * } - * queue = 0; - * } - * - * if queue = 1, then !_np - * - * 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. - * - * Copyright (c) 2009 Mathieu Desnoyers - */ - -#define get_pid() (_pid) - -int queue[2] = 0; -int fut = 0; - -active [2] proctype waker() -{ - assert(get_pid() < 2); - - queue[get_pid()] = 1; - - if - :: (fut == -1) -> - fut = 0; - :: else -> - skip; - fi; - - queue[get_pid()] = 1; - - if - :: (fut == -1) -> - fut = 0; - :: else -> - skip; - fi; - -#ifdef INJ_QUEUE_NO_WAKE - queue[get_pid()] = 1; -#endif -} - - -active proctype waiter() -{ - do - :: 1 -> -#ifndef INJ_LATE_DEC - fut = fut - 1; -#endif - if - :: (queue[0] == 1 || queue[1] == 1) -> -#ifndef INJ_LATE_DEC - fut = 0; -#endif - skip; - :: else -> -#ifdef INJ_LATE_DEC - fut = fut - 1; -#endif - if - :: (fut == -1) -> - do - :: 1 -> - if - :: (fut == -1) -> - skip; - :: else -> - break; - fi; - od; - :: else -> - skip; - fi; - fi; -progress: - if - :: queue[0] == 1 -> - queue[0] = 0; - fi; - if - :: queue[1] == 1 -> - queue[1] = 0; - fi; - od; -}