Yan Wang / Mbed 2 deprecated ProtoThread

Dependencies:   mbed

Committer:
phyllis
Date:
Tue Nov 30 22:14:29 2010 +0000
Revision:
0:1690a672d017

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
phyllis 0:1690a672d017 1 /*
phyllis 0:1690a672d017 2 * Copyright (c) 2004-2005, Swedish Institute of Computer Science.
phyllis 0:1690a672d017 3 * All rights reserved.
phyllis 0:1690a672d017 4 *
phyllis 0:1690a672d017 5 * Redistribution and use in source and binary forms, with or without
phyllis 0:1690a672d017 6 * modification, are permitted provided that the following conditions
phyllis 0:1690a672d017 7 * are met:
phyllis 0:1690a672d017 8 * 1. Redistributions of source code must retain the above copyright
phyllis 0:1690a672d017 9 * notice, this list of conditions and the following disclaimer.
phyllis 0:1690a672d017 10 * 2. Redistributions in binary form must reproduce the above copyright
phyllis 0:1690a672d017 11 * notice, this list of conditions and the following disclaimer in the
phyllis 0:1690a672d017 12 * documentation and/or other materials provided with the distribution.
phyllis 0:1690a672d017 13 * 3. Neither the name of the Institute nor the names of its contributors
phyllis 0:1690a672d017 14 * may be used to endorse or promote products derived from this software
phyllis 0:1690a672d017 15 * without specific prior written permission.
phyllis 0:1690a672d017 16 *
phyllis 0:1690a672d017 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
phyllis 0:1690a672d017 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
phyllis 0:1690a672d017 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
phyllis 0:1690a672d017 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
phyllis 0:1690a672d017 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
phyllis 0:1690a672d017 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
phyllis 0:1690a672d017 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
phyllis 0:1690a672d017 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
phyllis 0:1690a672d017 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
phyllis 0:1690a672d017 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
phyllis 0:1690a672d017 27 * SUCH DAMAGE.
phyllis 0:1690a672d017 28 *
phyllis 0:1690a672d017 29 * This file is part of the protothreads library.
phyllis 0:1690a672d017 30 *
phyllis 0:1690a672d017 31 * Author: Adam Dunkels <adam@sics.se>
phyllis 0:1690a672d017 32 *
phyllis 0:1690a672d017 33 * $Id: lc.h,v 1.2 2005/02/24 10:36:59 adam Exp $
phyllis 0:1690a672d017 34 */
phyllis 0:1690a672d017 35
phyllis 0:1690a672d017 36 /**
phyllis 0:1690a672d017 37 * \addtogroup pt
phyllis 0:1690a672d017 38 * @{
phyllis 0:1690a672d017 39 */
phyllis 0:1690a672d017 40
phyllis 0:1690a672d017 41 /**
phyllis 0:1690a672d017 42 * \defgroup lc Local continuations
phyllis 0:1690a672d017 43 * @{
phyllis 0:1690a672d017 44 *
phyllis 0:1690a672d017 45 * Local continuations form the basis for implementing protothreads. A
phyllis 0:1690a672d017 46 * local continuation can be <i>set</i> in a specific function to
phyllis 0:1690a672d017 47 * capture the state of the function. After a local continuation has
phyllis 0:1690a672d017 48 * been set can be <i>resumed</i> in order to restore the state of the
phyllis 0:1690a672d017 49 * function at the point where the local continuation was set.
phyllis 0:1690a672d017 50 *
phyllis 0:1690a672d017 51 *
phyllis 0:1690a672d017 52 */
phyllis 0:1690a672d017 53
phyllis 0:1690a672d017 54 /**
phyllis 0:1690a672d017 55 * \file lc.h
phyllis 0:1690a672d017 56 * Local continuations
phyllis 0:1690a672d017 57 * \author
phyllis 0:1690a672d017 58 * Adam Dunkels <adam@sics.se>
phyllis 0:1690a672d017 59 *
phyllis 0:1690a672d017 60 */
phyllis 0:1690a672d017 61
phyllis 0:1690a672d017 62 #ifdef DOXYGEN
phyllis 0:1690a672d017 63 /**
phyllis 0:1690a672d017 64 * Initialize a local continuation.
phyllis 0:1690a672d017 65 *
phyllis 0:1690a672d017 66 * This operation initializes the local continuation, thereby
phyllis 0:1690a672d017 67 * unsetting any previously set continuation state.
phyllis 0:1690a672d017 68 *
phyllis 0:1690a672d017 69 * \hideinitializer
phyllis 0:1690a672d017 70 */
phyllis 0:1690a672d017 71 #define LC_INIT(lc)
phyllis 0:1690a672d017 72
phyllis 0:1690a672d017 73 /**
phyllis 0:1690a672d017 74 * Set a local continuation.
phyllis 0:1690a672d017 75 *
phyllis 0:1690a672d017 76 * The set operation saves the state of the function at the point
phyllis 0:1690a672d017 77 * where the operation is executed. As far as the set operation is
phyllis 0:1690a672d017 78 * concerned, the state of the function does <b>not</b> include the
phyllis 0:1690a672d017 79 * call-stack or local (automatic) variables, but only the program
phyllis 0:1690a672d017 80 * counter and such CPU registers that needs to be saved.
phyllis 0:1690a672d017 81 *
phyllis 0:1690a672d017 82 * \hideinitializer
phyllis 0:1690a672d017 83 */
phyllis 0:1690a672d017 84 #define LC_SET(lc)
phyllis 0:1690a672d017 85
phyllis 0:1690a672d017 86 /**
phyllis 0:1690a672d017 87 * Resume a local continuation.
phyllis 0:1690a672d017 88 *
phyllis 0:1690a672d017 89 * The resume operation resumes a previously set local continuation, thus
phyllis 0:1690a672d017 90 * restoring the state in which the function was when the local
phyllis 0:1690a672d017 91 * continuation was set. If the local continuation has not been
phyllis 0:1690a672d017 92 * previously set, the resume operation does nothing.
phyllis 0:1690a672d017 93 *
phyllis 0:1690a672d017 94 * \hideinitializer
phyllis 0:1690a672d017 95 */
phyllis 0:1690a672d017 96 #define LC_RESUME(lc)
phyllis 0:1690a672d017 97
phyllis 0:1690a672d017 98 /**
phyllis 0:1690a672d017 99 * Mark the end of local continuation usage.
phyllis 0:1690a672d017 100 *
phyllis 0:1690a672d017 101 * The end operation signifies that local continuations should not be
phyllis 0:1690a672d017 102 * used any more in the function. This operation is not needed for
phyllis 0:1690a672d017 103 * most implementations of local continuation, but is required by a
phyllis 0:1690a672d017 104 * few implementations.
phyllis 0:1690a672d017 105 *
phyllis 0:1690a672d017 106 * \hideinitializer
phyllis 0:1690a672d017 107 */
phyllis 0:1690a672d017 108 #define LC_END(lc)
phyllis 0:1690a672d017 109
phyllis 0:1690a672d017 110 /**
phyllis 0:1690a672d017 111 * \var typedef lc_t;
phyllis 0:1690a672d017 112 *
phyllis 0:1690a672d017 113 * The local continuation type.
phyllis 0:1690a672d017 114 *
phyllis 0:1690a672d017 115 * \hideinitializer
phyllis 0:1690a672d017 116 */
phyllis 0:1690a672d017 117 #endif /* DOXYGEN */
phyllis 0:1690a672d017 118
phyllis 0:1690a672d017 119 #ifndef __LC_H__
phyllis 0:1690a672d017 120 #define __LC_H__
phyllis 0:1690a672d017 121
phyllis 0:1690a672d017 122
phyllis 0:1690a672d017 123 #ifdef LC_INCLUDE
phyllis 0:1690a672d017 124 #include LC_INCLUDE
phyllis 0:1690a672d017 125 #else
phyllis 0:1690a672d017 126 #include "lc-switch.h"
phyllis 0:1690a672d017 127 #endif /* LC_INCLUDE */
phyllis 0:1690a672d017 128
phyllis 0:1690a672d017 129 #endif /* __LC_H__ */
phyllis 0:1690a672d017 130
phyllis 0:1690a672d017 131 /** @} */
phyllis 0:1690a672d017 132 /** @} */