Commit ae0243f
committed
mp.input: send buffer ids with logs to avoid race conditions
This commit modifies the log methods in mp.input to always send the id
of the latest `input.get()` request with log entries, and allows
manually specifying an id to use instead.
Previously, the log methods applied to whichever input request happened
to be open when the log message was received. Even when scripts used
these methods correctly, there was the risk of sending a log to the
wrong log buffer if the active input request changed while the log
message was in transit; a race condition.
Now an id for the log buffer is always sent, either the id of the latest
`input.get()` request (preventing data races between scripts), or
a manually specified id passed as an extra parameter to the log methods
(preventing data races between multiple requests in the same script).
A side effect of this change is that logs can now be sent to specific
log buffers at any time, regardless of the currently active input
request (or lack thereof). I have not explicitly documented this as I
don't know if it's something we want to encourage.1 parent 82ec383 commit ae0243f
File tree
5 files changed
+80
-36
lines changed- DOCS/man
- player
- javascript
- lua
5 files changed
+80
-36
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1012 | 1012 | | |
1013 | 1013 | | |
1014 | 1014 | | |
1015 | | - | |
| 1015 | + | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | 1018 | | |
1019 | 1019 | | |
1020 | | - | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
1021 | 1026 | | |
1022 | 1027 | | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
1023 | 1031 | | |
1024 | | - | |
1025 | | - | |
| 1032 | + | |
| 1033 | + | |
1026 | 1034 | | |
1027 | 1035 | | |
1028 | 1036 | | |
1029 | 1037 | | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1030 | 1041 | | |
1031 | 1042 | | |
1032 | 1043 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
| 657 | + | |
657 | 658 | | |
658 | 659 | | |
659 | 660 | | |
| |||
682 | 683 | | |
683 | 684 | | |
684 | 685 | | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
| 686 | + | |
| 687 | + | |
689 | 688 | | |
690 | | - | |
691 | | - | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
692 | 692 | | |
693 | | - | |
694 | | - | |
695 | | - | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
696 | 702 | | |
697 | 703 | | |
698 | 704 | | |
699 | 705 | | |
700 | 706 | | |
701 | 707 | | |
702 | 708 | | |
703 | | - | |
| 709 | + | |
704 | 710 | | |
| 711 | + | |
705 | 712 | | |
706 | 713 | | |
707 | 714 | | |
708 | 715 | | |
709 | 716 | | |
710 | | - | |
711 | | - | |
712 | | - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
713 | 723 | | |
714 | | - | |
| 724 | + | |
| 725 | + | |
715 | 726 | | |
716 | | - | |
| 727 | + | |
717 | 728 | | |
718 | 729 | | |
719 | | - | |
| 730 | + | |
720 | 731 | | |
721 | 732 | | |
722 | 733 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1743 | 1743 | | |
1744 | 1744 | | |
1745 | 1745 | | |
1746 | | - | |
1747 | 1746 | | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
1748 | 1754 | | |
1749 | 1755 | | |
1750 | 1756 | | |
| |||
1757 | 1763 | | |
1758 | 1764 | | |
1759 | 1765 | | |
1760 | | - | |
| 1766 | + | |
1761 | 1767 | | |
1762 | 1768 | | |
1763 | 1769 | | |
| |||
1773 | 1779 | | |
1774 | 1780 | | |
1775 | 1781 | | |
1776 | | - | |
| 1782 | + | |
| 1783 | + | |
1777 | 1784 | | |
1778 | | - | |
| 1785 | + | |
1779 | 1786 | | |
1780 | 1787 | | |
1781 | 1788 | | |
| |||
1792 | 1799 | | |
1793 | 1800 | | |
1794 | 1801 | | |
1795 | | - | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
1796 | 1805 | | |
1797 | 1806 | | |
1798 | 1807 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
75 | 82 | | |
76 | 83 | | |
77 | 84 | | |
| |||
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
83 | | - | |
| 90 | + | |
84 | 91 | | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
94 | 105 | | |
95 | 106 | | |
96 | | - | |
97 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
98 | 111 | | |
99 | 112 | | |
100 | 113 | | |
0 commit comments