Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
thread.h
00001 /* 00002 # This file is Copyright 2007 Dean Hall. 00003 # This file is part of the PyMite VM. 00004 # This file is licensed under the MIT License. 00005 # See the LICENSE file for details. 00006 */ 00007 00008 00009 #ifndef __THREAD_H__ 00010 #define __THREAD_H__ 00011 00012 00013 /** 00014 * \file 00015 * \brief VM Thread 00016 * 00017 * Encapsulating a frame pointer, a root code object and thread state. 00018 */ 00019 00020 00021 #include "interp.h" 00022 00023 00024 /** Frequency in Hz to switch threads */ 00025 #define THREAD_RESCHEDULE_FREQUENCY 10 00026 00027 00028 /** 00029 * Interpreter return values 00030 * 00031 * Used to control interpreter loop 00032 * and indicate return value. 00033 * Negative values indicate erroneous results. 00034 * Positive values indicate "continue interpreting", 00035 * but first do something special like reschedule threads 00036 * or (TBD) sweep the heap. 00037 */ 00038 typedef enum PmInterpCtrl_e 00039 { 00040 /* other erroneous exits go here with negative values */ 00041 INTERP_CTRL_ERR = -1, /**< Generic error causes exit */ 00042 INTERP_CTRL_EXIT = 0, /**< Normal execution exit */ 00043 INTERP_CTRL_CONT = 1, /**< Continue interpreting */ 00044 INTERP_CTRL_RESCHED = 2 /**< Reschedule threads */ 00045 /* all positive values indicate "continue interpreting" */ 00046 } PmInterpCtrl_t, *pPmInterpCtrl_t; 00047 00048 /** 00049 * Thread obj 00050 * 00051 */ 00052 typedef struct PmThread_s 00053 { 00054 /** object descriptor */ 00055 PmObjDesc_t od; 00056 00057 /** current frame pointer */ 00058 pPmFrame_t pframe; 00059 00060 /** 00061 * Interpreter loop control value 00062 * 00063 * A positive value means continue interpreting. 00064 * A zero value means normal interpreter exit. 00065 * A negative value signals an error exit. 00066 */ 00067 PmInterpCtrl_t interpctrl; 00068 } PmThread_t, 00069 *pPmThread_t; 00070 00071 00072 /** 00073 * Constructs a thread for a root frame. 00074 * 00075 * @param pframe Frame object as a basis for this thread. 00076 * @param r_pobj Return by reference; Ptr to the newly created thread object. 00077 * @return Return status 00078 */ 00079 PmReturn_t thread_new(pPmObj_t pframe, pPmObj_t *r_pobj); 00080 00081 #endif /* __THREAD_H__ */
Generated on Tue Jul 12 2022 23:13:47 by
1.7.2