Wednesday, December 26, 2018

Re-entrant stack

I worked this problem, unsuccessfully my first job.
Let us define a protocol on args list.

We have one process filling, another emptying args list from two separate indices, and empty and fill.  The args list is assumed infinite until it is not, then the fill thread can safely stop filling. There is a stable initial point where both indices are at zero.

The one never writes index the other. But can one leave its own pointer in an intermediate unstable state?   Well, he has to write the updated value of its index in an atomic operation. If that assumption is met, then the emptying process will always seethe fill process incrementing or standing still, before it updates its own index. Thus the empty process will be ale to test its index without error as less than or equal, the stable condition, before updating its index. The filling process never looks at the emptying pointer.

I think this works.  I think the Xchars can run is own thread at mouse time and just use a push and pull stack on args list. When Xchars reaches the end of infinite, it stops the messages until restarted. The empty process can execute a restart in its own thread at Xchars, and Xchars will handle the handshake transparently.

In string format we have simple mouse and key messages.

KeyPress code;
PtrClked code x y;


Ican't think of any more, it is either keyboard, mouse; well, touch pad?

Touched x y;

Just pipe those message back to client, xchars provides calls for any shut,restart,echo, etc; Plus simple cursor select and place calls. All this in version 3, unless I find a good snippet already done the job.



No comments: