00001 /* 00002 # This file is Copyright 2007, 2009 Dean Hall. 00003 # 00004 # This file is part of the PyMite VM. 00005 # The PyMite VM is free software: you can redistribute it and/or modify 00006 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2. 00007 # 00008 # The PyMite VM is distributed in the hope that it will be useful, 00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00011 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2 00012 # is seen in the file COPYING in this directory. 00013 */ 00014 00015 00016 #ifndef __THREAD_H__ 00017 #define __THREAD_H__ 00018 00019 00028 #include "interp.h" 00029 00030 00032 #define THREAD_RESCHEDULE_FREQUENCY 10 00033 00034 00045 typedef enum PmInterpCtrl_e 00046 { 00047 /* other erroneous exits go here with negative values */ 00048 INTERP_CTRL_ERR = -1, 00049 INTERP_CTRL_EXIT = 0, 00050 INTERP_CTRL_CONT = 1, 00051 INTERP_CTRL_RESCHED = 2 00052 /* all positive values indicate "continue interpreting" */ 00053 } PmInterpCtrl_t, *pPmInterpCtrl_t; 00054 00059 typedef struct PmThread_s 00060 { 00062 PmObjDesc_t od; 00063 00065 pPmFrame_t pframe; 00066 00074 PmInterpCtrl_t interpctrl; 00075 } PmThread_t, 00076 *pPmThread_t; 00077 00078 00086 PmReturn_t thread_new(pPmObj_t pframe, pPmObj_t *r_pobj); 00087 00088 #endif /* __THREAD_H__ */