| |
| /pliant/language/schedule/thread.pli |
| |
| 1 |
# Copyright Hubert Tonneau hubert.tonneau@pliant.cx | |
| 2 |
# | |
| 3 |
# This program is free software; you can redistribute it and/or | |
| 4 |
# modify it under the terms of the GNU General Public License version 2 | |
| 5 |
# as published by the Free Software Foundation. | |
| 6 |
# | |
| 7 |
# This program is distributed in the hope that it will be useful, | |
| 8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 9 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 10 |
# GNU General Public License for more details. | |
| 11 |
# | |
| 12 |
# You should have received a copy of the GNU General Public License | |
| 13 |
# version 2 along with this program; if not, write to the Free Software | |
| 14 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 15 |
| |
| 16 |
scope "/pliant/language/" "/pliant/install/" | |
| 17 |
module "/pliant/install/ring3.pli" | |
| 18 |
| |
| 19 |
| |
| 20 |
function run_thread2 da | |
| 21 |
arg DelayedAction da | |
| 22 |
if not run_thread:da | |
| 23 |
error error_id_starvation "Failed to run another thread" | |
| 24 |
| |
| 25 |
| |
| 26 |
meta thread e | |
| 27 |
if e:size<>1 | |
| 28 |
return | |
| 29 |
var Link:List expressions :> new List | |
| 30 |
var Link:List byaddress :> new List | |
| 31 |
expressions append (addressof e:0) | |
| 32 |
var Pointer:Module module :> e module | |
| 33 |
var Address mark := module mark | |
| 34 |
module define "pliant shared" addressof:byaddress | |
| 35 |
module define "share" addressof:(the_meta 'pliant share arguments') | |
| 36 |
var List functions ; var Link:Type type | |
| 37 |
e freeze expressions byaddress functions type | |
| 38 |
module rewind mark | |
| 39 |
void ? | |
| 40 |
e add (instruction (the_function run_thread2 DelayedAction) e:0:result) | |
| 41 |
e set_void_result | |
| 42 |
| |
| 43 |
export thread | |
| |