| View previous topic :: View next topic |
| Author |
Message |
cen Guest
|
Posted: Thu Mar 01, 2007 7:04 pm Post subject: winlirc script bug |
|
|
| hope this is the right place to post...i found a bug in the winlirc script for autohotkey. the ReceiveData(...) function should not call recv() itself, because this sometimes leads to window-message problems (recv called, FD_READ flag gets reset, new data comes in before ReceiveData() ends -> nothing happens any more because the notification message got thrown away). this bug can be fixed by having the notification message call a function that sets a very short timer to call the ReceiveData() function (this way, the OnCommand function exits before recv() gets called and the flag reset) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Mar 01, 2007 9:04 pm Post subject: |
|
|
| Thanks; I'll look into this. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sat Mar 03, 2007 1:43 am Post subject: |
|
|
I think I see what you mean. The WinLIRC script had been using a loop to call recv() repeatedly until there was no more data. But it was still possible that data could be received while ReceiveData() was processing previous data, which would cause the notification message to get lost due to "thread already running" (as documented in on the OnMessage page).
To solve this, I'd had it on my to-do list to apply the Critical command ("Critical" was added to AutoHotkey after the WinLIRC script was developed). So I have now added "Critical" as the first line of ReceiveData(), which should cause notification messages to get buffered rather than dropped.
If you see any problems with this solution, or notice any unreliability in the script that isn't attributable to WinLIRC, please let me know. I've been using this script myself on a daily basis (including the above enhancement for the past two months) and it seems to work well.
The updated script is at http://www.autohotkey.com/docs/scripts/WinLIRC.htm
Thanks. |
|
| Back to top |
|
 |
|