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.
src/vm/thread.c
- Committer:
- dadaista
- Date:
- 2010-07-21
- Revision:
- 0:14e5e829dffe
File content as of revision 0:14e5e829dffe:
/* # This file is Copyright 2007, 2009 Dean Hall. # # This file is part of the PyMite VM. # The PyMite VM is free software: you can redistribute it and/or modify # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2. # # The PyMite VM 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. # A copy of the GNU GENERAL PUBLIC LICENSE Version 2 # is seen in the file COPYING in this directory. */ #undef __FILE_ID__ #define __FILE_ID__ 0x16 /** * \file * \brief VM Thread * * Encapsulating a frame pointer, a root code object and thread state. */ #include "pm.h" PmReturn_t thread_new(pPmObj_t pframe, pPmObj_t *r_pobj) { PmReturn_t retval = PM_RET_OK; pPmThread_t pthread = C_NULL; C_ASSERT(pframe != C_NULL); /* If it's not a frame, raise TypeError */ if (OBJ_GET_TYPE(pframe) != OBJ_TYPE_FRM) { PM_RAISE(retval, PM_RET_EX_TYPE); return retval; } /* Allocate a thread */ retval = heap_getChunk(sizeof(PmThread_t), (uint8_t **)r_pobj); PM_RETURN_IF_ERROR(retval); /* Set type, frame and initialize status */ pthread = (pPmThread_t)*r_pobj; OBJ_SET_TYPE(pthread, OBJ_TYPE_THR); pthread->pframe = (pPmFrame_t)pframe; pthread->interpctrl = INTERP_CTRL_CONT; return retval; }