possible degrade with change set "protect movelist during autosave"

View: New views
4 Messages — Rating Filter:   Alert me  

possible degrade with change set "protect movelist during autosave"

by 保坂範行 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

How to reproduce:
Play a match with gnubg, then let gnubg to analyze match.
Do not get any move list for moves for the recorded match.


I'm very sure that this problem caused by change set "protect movelist
during autosave".
Built both source before change and source after change.

I hope this report helps you.

Nori

[0001-protect-movelist-during-autosave.patch]

From 2b53c30a6b9ac3c0f4d6ba6ea1b8575496f96317 Mon Sep 17 00:00:00 2001
From: c_anthon <c_anthon>
Date: Wed, 7 Oct 2009 19:17:46 +0000
Subject: [PATCH] protect movelist during autosave

---
 ChangeLog  |    4 ++++
 analysis.c |   35 ++++++++++++++++++++---------------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1540ae8..a5da10c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Oct  7 21:17:04 CEST 2009 Christian Anthon <anthon@...>
+
+ * analysis.c: protect movelist during autosave
+
 Tue Oct  2 04:32:27 MDT 2009 Michael Petch <mpetch@...>
 
  * progress.c: Fix assert/crash when doing a single rollout
diff --git a/analysis.c b/analysis.c
index de4f063..32b8e8a 100644
--- a/analysis.c
+++ b/analysis.c
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: analysis.c,v 1.220 2009/10/01 21:05:53 c_anthon Exp $
+ * $Id: analysis.c,v 1.221 2009/10/07 19:17:46 c_anthon Exp $
  */
 
 #include "config.h"
@@ -723,24 +723,29 @@ AnalyzeMove (moverecord *pmr, matchstate *pms, const listOLD *plParentGame,
  ApplyMove( anBoardMove, pmr->n.anMove, FALSE );
  PositionKey ( (ConstTanBoard)anBoardMove, auch );
   
- if ( cmp_evalsetup ( pesChequer,
- &pmr->esChequer ) > 0 ) {
+ if (cmp_evalsetup(pesChequer, &pmr->esChequer) > 0) {
+
+ if (pmr->ml.cMoves)
+ free(pmr->ml.amMoves);
 
- if( pmr->ml.cMoves )
- free( pmr->ml.amMoves );
-  
  /* find best moves */
-  
- MT_Release();
- if( FindnSaveBestMoves ( &(pmr->ml), pmr->anDice[ 0 ],
- pmr->anDice[ 1 ],
- (ConstTanBoard)pms->anBoard, auch,
- arSkillLevel[ SKILL_DOUBTFUL ],
- &ci, &pesChequer->ec, aamf ) < 0 )
- return -1;
- MT_Exclusive();
 
+ {
+ movelist ml;
+ MT_Release();
+ if (FindnSaveBestMoves(&ml, pmr->anDice[0],
+ pmr->anDice[1],
+ (ConstTanBoard) pms->anBoard, auch,
+ arSkillLevel[SKILL_DOUBTFUL],
+ &ci, &pesChequer->ec, aamf) < 0)
+ return -1;
+ MT_Exclusive();
+ CopyMoveList(&ml, &pmr->ml);
+ if (ml.cMoves)
+ free(ml.amMoves);
  }
+
+ }
   
  for( pmr->n.iMove = 0; pmr->n.iMove < pmr->ml.cMoves;
  pmr->n.iMove++ )
--
1.5.5.6



_______________________________________________
Bug-gnubg mailing list
Bug-gnubg@...
http://lists.gnu.org/mailman/listinfo/bug-gnubg

Parent Message unknown Re: possible degrade with change set "protect movelist during autosave"

by Jonathan Kinsey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
A safer approach is to only save in between move analysis, something like:

main thread: wait until save timeout, then set flag (or event)
worker threads: check flag before each move, if set increment a counter and wait
for save to finish
main thread: do save when all threads have stopped (then reset flag)

This won't be great for performance if the save interval is small, but I assume
analysis saving is only useful for very long match analysis operations.

Jon

保坂範行 wrote:
> Hi,
>
> How to reproduce:
> Play a match with gnubg, then let gnubg to analyze match.
> Do not get any move list for moves for the recorded match.
>
>
> I'm very sure that this problem caused by change set "protect movelist
> during autosave".
> Built both source before change and source after change.
>
> I hope this report helps you.
>
> Nori
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Bug-gnubg mailing list
> Bug-gnubg@...
> http://lists.gnu.org/mailman/listinfo/bug-gnubg





View your other email accounts from your Hotmail inbox. Add them now.
_______________________________________________
Bug-gnubg mailing list
Bug-gnubg@...
http://lists.gnu.org/mailman/listinfo/bug-gnubg

Re: possible degrade with change set "protect movelist during autosave"

by Christian Anthon-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This was just a mistake in the bug fix. Reversed the source and the
destination in the movelist copy.

Christian.

2009/10/9 Jonathan Kinsey <jon_kinsey@...>:

> A safer approach is to only save in between move analysis, something like:
>
> main thread: wait until save timeout, then set flag (or event)
> worker threads: check flag before each move, if set increment a counter and
> wait
> for save to finish
> main thread: do save when all threads have stopped (then reset flag)
>
> This won't be great for performance if the save interval is small, but I
> assume
> analysis saving is only useful for very long match analysis operations.
>
> Jon
>
> 保坂範行 wrote:
>> Hi,
>>
>> How to reproduce:
>> Play a match with gnubg, then let gnubg to analyze match.
>> Do not get any move list for moves for the recorded match.
>>
>>
>> I'm very sure that this problem caused by change set "protect movelist
>> during autosave".
>> Built both source before change and source after change.
>>
>> I hope this report helps you.
>>
>> Nori
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Bug-gnubg mailing list
>> Bug-gnubg@...
>> http://lists.gnu.org/mailman/listinfo/bug-gnubg
>
>
>
>
> ________________________________
> View your other email accounts from your Hotmail inbox. Add them now.
> _______________________________________________
> Bug-gnubg mailing list
> Bug-gnubg@...
> http://lists.gnu.org/mailman/listinfo/bug-gnubg
>
>


_______________________________________________
Bug-gnubg mailing list
Bug-gnubg@...
http://lists.gnu.org/mailman/listinfo/bug-gnubg

Re: possible degrade with change set "protect movelist during autosave"

by Massimiliano Maini-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've rebuilt including the fix and FTPed to gnubg.org.

If you have downoloadad the last 20091009 install/exes before now
(2:33 PM GMT), please redownload it.

MaX.

2009/10/9 Christian Anthon <christian.anthon@...>:
> This was just a mistake in the bug fix. Reversed the source and the
> destination in the movelist copy.
>
> Christian.


_______________________________________________
Bug-gnubg mailing list
Bug-gnubg@...
http://lists.gnu.org/mailman/listinfo/bug-gnubg