| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/sequence/sequence_creation.c')
| -rw-r--r-- | src/sequence/sequence_creation.c | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/src/sequence/sequence_creation.c b/src/sequence/sequence_creation.c index 0b5e393..2e8e17e 100644 --- a/src/sequence/sequence_creation.c +++ b/src/sequence/sequence_creation.c @@ -45,10 +45,10 @@ static int extend_left { JH_index sequence_id, word_id; - (void) JH_knowledge_lock_access(k, io); - /* preceding_words_weights_sum > 0 */ + JH_knowledge_readlock_sequences(k, io); + if ( JH_knowledge_find_sequence @@ -60,16 +60,14 @@ static int extend_left ) < 0 ) { - (void) JH_knowledge_unlock_access(k, io); + JH_knowledge_readunlock_sequences(k, io); JH_S_ERROR(io, "Could not find matching TWS sequence."); return -1; } - (void) JH_knowledge_unlock_access(k, io); - - (void) JH_knowledge_lock_access(k, io); + JH_knowledge_readunlock_sequences(k, io); if ( @@ -78,19 +76,16 @@ static int extend_left k, &word_id, (*sequence)[0], - sequence_id + sequence_id, + io ) < 0 ) { - (void) JH_knowledge_unlock_access(k, io); - JH_S_ERROR(io, "Could not find matching TWS target."); return -1; } - (void) JH_knowledge_unlock_access(k, io); - if ( JH_sequence_append_left @@ -243,10 +238,10 @@ static int extend_right { JH_index sequence_id, word_id; - (void) JH_knowledge_lock_access(k, io); - /* preceding_words_weights_sum > 0 */ + JH_knowledge_readlock_sequences(k, io); + if ( JH_knowledge_find_sequence @@ -258,7 +253,7 @@ static int extend_right ) < 0 ) { - (void) JH_knowledge_unlock_access(k, io); + JH_knowledge_readunlock_sequences(k, io); JH_S_PROG_ERROR ( @@ -270,9 +265,7 @@ static int extend_right return -1; } - (void) JH_knowledge_unlock_access(k, io); - - (void) JH_knowledge_lock_access(k, io); + JH_knowledge_readunlock_sequences(k, io); if ( @@ -281,12 +274,11 @@ static int extend_right k, sequence_id, (*sequence)[*sequence_length - 1], - &word_id + &word_id, + io ) < 0 ) { - (void) JH_knowledge_unlock_access(k, io); - JH_S_PROG_ERROR ( io, @@ -297,9 +289,6 @@ static int extend_right return -1; } - (void) JH_knowledge_unlock_access(k, io); - - /* following_words_weights_sum > 0 */ if @@ -314,13 +303,9 @@ static int extend_right ) < 0 ) { - (void) JH_knowledge_unlock_access(k, io); - return -3; } - (void) JH_knowledge_unlock_access(k, io); - return 0; } @@ -454,8 +439,6 @@ static int initialize_sequence { sequence[(markov_order - 1)] = initial_word; - (void) JH_knowledge_lock_access(k, io); - if ( JH_knowledge_copy_random_swt_sequence @@ -468,13 +451,9 @@ static int initialize_sequence ) < 0 ) { - (void) JH_knowledge_unlock_access(k, io); - return -1; } - (void) JH_knowledge_unlock_access(k, io); - if (JH_DEBUG_SEQUENCE_CREATION_INIT) { JH_index i; |


