Dave Matthews,
I am building a thread manager for the .NET CLR that emulates your threading model in Poly ML I am a little confused by a couple of issues in your file Basis/Thread.Sml
You have a set of associated types declared as such
datatype threadAttribute = EnableBroadcastInterrupt of bool | InterruptState of interruptState
and interruptState = InterruptDefer | InterruptSynch | InterruptAsynch | InterruptAsynchOnce
You then create functions for writing these into a tuple of words as bit flags With the following mapping
1 -> InterruptDefer 2 -> InterruptSynch 4 -> InterruptAsynch 6 -> InterruptAsynchOnce
And then mapping the lowest bit of the other word in the tuple to the flag in EnableBroadcastInterrupt
My questions are
1. What is the semantics of these flags as related to the behavior of threads and the Interrupt signal?
2. Can a single word be used to model these flags thusly (see below) given that I am using a completely different runtime than what you are calling into? 1 -> InterruptDefer 2 -> InterruptSynch 4 -> InterruptAsynch 6 -> InterruptAsynchOnce 8 -> BroadcastInterrupt
I now you don't get many questions from people working with the CLR so I appreciate your patience
David Thayer
Hi David,
On 06/06/2011 23:48, Dave Thayer wrote:
My questions are
What is the semantics of these flags as related to the behavior of threads and the Interrupt signal?
Have you looked at http://www.polyml.org/docs/Threads.html ? There's an explanation there. If it's not clear please let me know. This is really one of the most problematic bits of the threading model in Poly/ML.
- Can a single word be used to model these flags thusly (see below)
given that I am using a completely different runtime than what you are calling into?
1 -> InterruptDefer 2 -> InterruptSynch 4 -> InterruptAsynch 6 -> InterruptAsynchOnce 8 -> BroadcastInterrupt
Poly/ML currently uses a single word for these. The mapping is 1 -> Broadcast OR-ed with: 2 -> Synch 4 -> Asynch 6 -> AsynchOnce
It's actually in the second word of a 4-word thread object. The first word is a tagged integer which is an index into the thread table in the run-time system, the third points to a list of thread-local data and the fourth is a "hint" used in interrupt handling.
Regards, David