2011/3/5 Rick McGuire <object.r...@gmail.com>
> I guess I'd need to know a reason. If the purpose is to somehow map
> this back to the Rexx thread, then I'm not comfortable with exposing a
> system-specific concept such as a thread id to any ooRexx construct.
> The issue of Rexx thread identifiers should be kept separate from
> whatever convention the system uses to identify thread.
>
>
ok... I need it for my current work on coactivity (ako coroutine, but of
course not a real coroutine, just a synchronisation of two ooRexx
activities).
I will commit that soon, in my sandbox.
In the meantime, here is an excerpt :
::method start
/*
Create the thread that will control the coactivity and make it
suspended.
Use 'resume' to start the coactivity effectively.
The arguments passed to the first 'resume' will be made available to the
coactivity through the traditional 'use arg'.
The arguments passed to the next 'resume's will be made available as an
array returned by 'yield'.
*/
....
status = .Coactivity~suspended
reply self
self~threadId = SysQueryProcess("TID")
.Coactivity~directory[self~threadId] = self
....
::method yield class
/*
Helper method to let yield from any nested invocation
(i.e. directly or indirectly called by the coactivity 'start' method).
The goal is to retrieve the coactivity instance and send it the message
yield.
*/
coactivity = .Coactivity~directory[SysQueryProcess("TID")]
if coactivity == .nil then raise syntax 93.900 array ("yield can be used
only from a coactivity")
forward to (coactivity)
As you can see, I use the thread id as an index in a directory.
Can be seen as an emulation of RFE 2868655 : "Add ThreadLocal concept".
Now, if you know another way to do that, let me know.
Regards
Jean-Louis
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel