windows "thread" question
- Posted by Kat <gertie at PELL.NET> Sep 27, 2001
- 398 views
Hi all windows programmers, i have a question, and i am not sure i can explain it properly, but i'll try... Lets say i have 3 Eu programs running... program1 program2, program3 and they each know the others *can* exist, and they know how to handshake with the other program to verify the other program is there. Just how they do this would be OS dependant, i'll use win95 and either DDE, winsock, or win_msgs. Commands they can exchange would be, for each program: dothis1a, dothis1b, abort1 dothis2a, dothis2b, abort2 dothis3a, dothis3b, abort3 The commands represent functions, which return nested sequences. Each program knows what is returned in the nested sequence. Suppose program1 is told to insert code before the return() line in program2. It cannot change the existing returned sequence, but it can add another nested sequence to that original one, and the calling program can ignore that additional sequence if it wants to, or not, for whatever reason. Program1 would use this additional code by doing abort2, and restarting the modified program2. Here is the question: How does program3 know what program1 is doing to program2 in terms of the abort2? Program3 could be calling dothis2b while program1 has just called abort2. Program3 did a handshake with program2 to verify it was there, but right after that handshake, program1 shut down program2! How do i prevent this? Can i make the windows program2 ignore the abort2 event (from program1) or the dothis2b event (from program3)? What if the OS delivers abort1 from program2 while program1 is waiting on a result from program2's dothis2a? How can i be sure of the order of msg arrival, and make the order of recieved msgs execute in the "right" order? For timestamping the msgs, i can't even be positive of the time() function in Eu if the OS is preemptively timeslicing the programs out, can i? What if program1 gets time(), the OS pages out to program3 which does time() *and* then sends the msg, i *still* cannot be sure of which msg will arrive at program2 first, can i?,,, because now program1 executes and delivers the msg to program2's que, right?, before the msg from program3 is actually delivered to program2. And i just showed how the timestamps could be reversed. Yes, i am considering self-modifying programs, and self-cloning programs, with Euphoria. Or should i look at another language? Kat