Jingyuan Dong / Mbed 2 deprecated protoThread

Dependencies:   mbed

Committer:
guruimage
Date:
Wed Dec 01 02:46:33 2010 +0000
Revision:
0:9b9c31c57895
protoThread problem for hw2

Who changed what in which revision?

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