Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!satisfied.elf.com!news.mathworks.com!uunet!objy!server!dann
From: dann@server.Objy.COM (Dann Treachler)
Subject: Re: Accessing sender
Message-ID: <1995Feb7.234133.744@objy.com>
Sender: dann@server (Dann Treachler)
Nntp-Posting-Host: server
Organization: Objectivity, Inc.
References:  <3h8586$dn7@epsilon.qmw.ac.uk>
Date: Tue, 7 Feb 95 23:41:33 GMT
Lines: 24

In article <3h8586$dn7@epsilon.qmw.ac.uk>, johnsam@dcs.qmw.ac.uk (John Samuel) writes:
|> 
|> Is there any way to access the sender of a message, without suspending 
|> the current process and looking at its context ? 
|> 
|> The following works but is slow
|> 
|> activeSender
|> |s p sem|
|> p := Processor activeProcess.
|> sem := Semaphore new.
|> [s := p suspendedContext sender sender receiver. sem signal] fork.
|> sem wait.
|> ^s
|> 

Just use the builtin "thisContext" (I'm presuming you are using PP Smalltalk):

   ^thisContext sender sender receiver.

-----------------------------------------------------------
Dann Treachler			email: dann@objy.com
Objectivity. Inc.
-----------------------------------------------------------
