Changeset 646 for trunk/server/thread.c

Show
Ignore:
Timestamp:
11/20/07 07:01:27 (2 years ago)
Author:
dormando
Message:

Dynamic suffix buffer work.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/server/thread.c

    r619 r646  
    4848static pthread_mutex_t conn_lock; 
    4949 
     50/* Lock for alternative item suffix freelist */ 
     51static pthread_mutex_t suffix_lock; 
     52 
    5053/* Lock for cache operations (item_*, assoc_*) */ 
    5154static pthread_mutex_t cache_lock; 
     
    245248    return result; 
    246249} 
     250 
     251/* 
     252 * Pulls a suffix buffer from the freelist, if one is available. 
     253 */ 
     254char *mt_suffix_from_freelist() { 
     255    char *s; 
     256 
     257    pthread_mutex_lock(&suffix_lock); 
     258    s = do_suffix_from_freelist(); 
     259    pthread_mutex_unlock(&suffix_lock); 
     260 
     261    return s; 
     262} 
     263 
     264 
     265/* 
     266 * Adds a suffix buffer to the freelist. 
     267 * 
     268 * Returns 0 on success, 1 if the buffer couldn't be added. 
     269 */ 
     270bool mt_suffix_add_to_freelist(char *s) { 
     271    bool result; 
     272 
     273    pthread_mutex_lock(&conn_lock); 
     274    result = do_conn_add_to_freelist(s); 
     275    pthread_mutex_unlock(&conn_lock); 
     276 
     277    return result; 
     278} 
     279 
    247280 
    248281/****************************** LIBEVENT THREADS *****************************/