in reply to Is GUITest SetForegroundWindow/Sendkey thread safe?
- First thing. This has nothing whatever to do with "thread safety".
- Imagine that there is another copy of your program also running on the machine but looking for a different window.
If your program calls SetForegroundWindow(), and then reaches the end of its timeslice and gets preempted; then the other program might call SetForegroundWindow before your program gets around to calling SendKeys().
With just two programs with two actions (SFW & SK) each, there are six possibilities for the ordering of those 4 actions:
A A A B B B A B B A A B B A B B A A B B A A B AOnly two will produce the desired result for both programs.
If so, what could one way be of fixing this,
The only sure way would be to wrap the two actions in a Critical Section.
This isn't (cannot easily be) available to Perl code.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Is GUITest SetForegroundWindow/Sendkey thread safe?
by MPQC (Initiate) on Mar 26, 2014 at 17:40 UTC | |
by BrowserUk (Patriarch) on Mar 26, 2014 at 20:47 UTC | |
by GrandFather (Saint) on Mar 26, 2014 at 20:45 UTC |
In Section
Seekers of Perl Wisdom