Continuation.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Sep 2004 16:27:04 +0200
changeset 8559 aca77c69cd91
parent 8558 09e2910c1e4f
child 8582 115869898a97
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 2004 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

"{ Package: 'stx:libbasic' }"

Object subclass:#Continuation
	instanceVariableNames:'process id suspendContext'
	classVariableNames:''
	poolDictionaries:''
	category:'Kernel-Processes'
!

!Continuation class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2004 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Initial attempt - Contnuations do not work yet.

    [Instance variables:]

        id                     <SmallInteger>   a unique continuation-id;
                                                Used to identify a corresponding 
                                                data-structure in the VM.

        process                <Process>        the process which created this continuation.

    [Class variables:]

    [see also:]
        Process Context Block

    [author:]
        Claus Gittinger
"
! !

!Continuation class methodsFor:'instance creation'!

new
    |cont id|

    cont := super new.
%{
    int __cId;
    extern int __continuationCreate();

    __cId = __continuationCreate(cont);
    if (__cId) {
        id = __MKSMALLINT(__cId);
    }
%}.
    id isNil ifTrue:[
        self error:'could not create continuation' mayProceed:true.
        ^ nil.
    ].
    cont setId:id process:(Processor activeProcess).
    ^ cont
! !

!Continuation methodsFor:'private accessing'!

setId:idArg process:aProcess
    id := idArg.
    process := aProcess.
! !

!Continuation class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/Continuation.st,v 1.5 2004-09-20 14:27:04 cg Exp $'
! !