Aleks31 / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

remove glock.py and convert from threads_enter to idle_add #914

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
To fix most of the remaining deadlocks and to get rid of the deprecated 
threads_enter, we need to remove glock.py and convert from threads_enter to 
idle_add (or timeout_add or whatever).

A preliminary patch which I've tested a little bit is attached. Since this 
involves changing (currently) 290 code blocks from synchronous code to 
asynchronous code, it is not a simple mass rename/regexp replacement.

Original issue reported on code.google.com by mattgatto on 18 Sep 2014 at 8:46

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Seems this patch only changes one block to idle_add(). Or is this just to wet 
our appetite? :)
Matt, can you attach the full patch, please?

Original comment by gbtami on 19 Sep 2014 at 7:49

GoogleCodeExporter commented 8 years ago
That is all there is so far.

Original comment by mattgatto on 19 Sep 2014 at 1:28

GoogleCodeExporter commented 8 years ago
Ah, I misunderstand then, sorry.

Original comment by gbtami on 19 Sep 2014 at 1:47

GoogleCodeExporter commented 8 years ago
I've converted ICLounge.py (attached), and it works well with no dead-locks in 
my limited testing. With the patch the Players and Games lists populate alot 
quicker on login, as well. Unfortunately I've been unable to apply the same 
changes to ICLogin.py so far without the UI dead-locking upon login. I'm in the 
process of redesigning the IC control logic, both, to make it possible to 
finish the idle_add conversion, and to make IC code more robust against 
deadlocks.

Original comment by mattgatto on 3 Dec 2014 at 12:41

GoogleCodeExporter commented 8 years ago
The attached patch converts discovererDialog.py, but 1/10 in my tests it 
deadlocks. Do you have any idea why?

Original comment by gbtami on 4 Dec 2014 at 3:11

Attachments:

GoogleCodeExporter commented 8 years ago
I don't know. That patch doesn't deadlock my system. I only have 3 engines 
installed though ATM (stockfish, gnuchess, and sjeng).

Original comment by mattgatto on 4 Dec 2014 at 4:02

GoogleCodeExporter commented 8 years ago
I get 2 errors while testing your patch :
TypeError: onCurGameEnded() takes exactly 2 arguments (3 given)
TypeError: onPlayingGame() takes exactly 2 arguments (3 given)

Original comment by gbtami on 4 Dec 2014 at 4:06

GoogleCodeExporter commented 8 years ago
What does the log say? I don't think mixing threads_enter with idle_add in the 
same application is supposed to be done, so we might not know whether this is 
the cause until we've finished the conversion and removed glock.py. Also, you 
can use the @idle_add decorator from the patch in my comment 5, you don't 
usually need to directly setup an update_gui() callback and gobject.idle_add() 
it.

Original comment by mattgatto on 4 Dec 2014 at 4:06

GoogleCodeExporter commented 8 years ago
Here's the patch without the errors from comment 8.

Original comment by mattgatto on 4 Dec 2014 at 4:13

Attachments:

GoogleCodeExporter commented 8 years ago
I think we should commit these patches to idle_add branch, so I committed my 
first one using your @idle_add decorator.

Original comment by gbtami on 5 Dec 2014 at 11:02

GoogleCodeExporter commented 8 years ago
To speed up the animation issues when using an analyzer, we might try 
experimenting with adding decorators that use gobject.PRIORITY_HIGH and 
timeout_add instead of idle_add when drawing game board stuff.

Original comment by mattgatto on 7 Dec 2014 at 6:02