| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/sequence')
| -rw-r--r-- | src/sequence/sequence_creation.c | 45 | ||||
| -rw-r--r-- | src/sequence/sequence_from_string.c | 6 | ||||
| -rw-r--r-- | src/sequence/sequence_to_string.c | 4 |
3 files changed, 13 insertions, 42 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; diff --git a/src/sequence/sequence_from_string.c b/src/sequence/sequence_from_string.c index 5b92943..5e434f3 100644 --- a/src/sequence/sequence_from_string.c +++ b/src/sequence/sequence_from_string.c @@ -30,8 +30,6 @@ static int add_word_to_sequence { JH_index word_id; - (void) JH_knowledge_lock_access(k, io); - if ( JH_knowledge_learn_word @@ -44,13 +42,9 @@ static int add_word_to_sequence ) < 0 ) { - (void) JH_knowledge_unlock_access(k, io); - return -1; } - (void) JH_knowledge_unlock_access(k, io); - if ( JH_sequence_append_right diff --git a/src/sequence/sequence_to_string.c b/src/sequence/sequence_to_string.c index 6794fcb..70dcf1a 100644 --- a/src/sequence/sequence_to_string.c +++ b/src/sequence/sequence_to_string.c @@ -114,9 +114,7 @@ static int add_word return 0; } - (void) JH_knowledge_lock_access(k, io); - JH_knowledge_get_word(k, word_id, &word, &word_size); - (void) JH_knowledge_unlock_access(k, io); + JH_knowledge_get_word(k, word_id, &word, &word_size, io); insertion_point = *destination_length; |


