1
1
This commit was SVN r318.
Этот коммит содержится в:
Tim Woodall 2004-01-13 02:34:20 +00:00
родитель 5bfddeed7e
Коммит 4327aa2178
7 изменённых файлов: 27 добавлений и 29 удалений

Просмотреть файл

@ -36,7 +36,7 @@ lam_class_info_t lam_free_lists_cls = {"lam_free_lists_t", &lam_object_cls,
void lam_free_lists_init(lam_free_lists_t *flist)
{
SUPER_INIT(flist, lam_free_lists_cls.cls_parent);
lam_mtx_init(&flist->fl_lock);
lam_mutex_init(&flist->fl_lock);
flist->fl_pool = NULL;
flist->fl_elt_cls = NULL;
flist->fl_description = NULL;

Просмотреть файл

@ -24,7 +24,7 @@ void lam_mp_init(lam_mem_pool_t *pool)
SUPER_INIT(pool, mem_pool_cls.cls_parent);
CREATE_OBJECT(pool->mp_private_alloc, lam_allocator_t, &allocator_cls);
lam_mtx_init(&(pool->mp_lock));
lam_mutex_init(&(pool->mp_lock));
pool->mp_dev_alloc = NULL;
}
@ -33,7 +33,7 @@ void lam_mp_shared_init(lam_mem_pool_t *pool)
SUPER_INIT(pool, shmem_pool_cls.cls_parent);
CREATE_OBJECT(pool->mp_private_alloc, lam_allocator_t, &allocator_cls);
lam_mtx_init(&(pool->mp_lock));
lam_mutex_init(&(pool->mp_lock));
lam_alc_set_is_shared(pool->mp_private_alloc, 1);
lam_alc_set_mem_prot(pool->mp_private_alloc, MMAP_SHARED_PROT);
pool->mp_dev_alloc = NULL;
@ -175,7 +175,7 @@ void *lam_mp_request_chunk(lam_mem_pool_t *pool, int pool_index)
int desc;
/* grab lock on pool */
lam_mtx_lock(&(pool->mp_lock));
lam_mutex_lock(&(pool->mp_lock));
/* Have we used all the allocated memory? */
if ( pool->mp_next_avail_chunk == pool->mp_num_chunks )
@ -186,7 +186,7 @@ void *lam_mp_request_chunk(lam_mem_pool_t *pool, int pool_index)
if ( lam_mp_uses_shared_mem(pool) ||
((pool->mp_max_chunks > 0) && (pool->mp_num_chunks == pool->mp_max_chunks)) )
{
lam_mtx_unlock(&(pool->mp_lock));
lam_mutex_unlock(&(pool->mp_lock));
return chunk;
}
@ -197,7 +197,7 @@ void *lam_mp_request_chunk(lam_mem_pool_t *pool, int pool_index)
if ( !chunk_desc )
{
lam_err(("Error! Out of memory!\n"));
lam_mtx_unlock(&(pool->mp_lock));
lam_mutex_unlock(&(pool->mp_lock));
return 0;
}
@ -219,7 +219,7 @@ void *lam_mp_request_chunk(lam_mem_pool_t *pool, int pool_index)
if ( !pool->mp_chunks[pool->mp_num_chunks].chd_base_ptr )
{
lam_err(("Error: Out of memory\n"));
lam_mtx_unlock(&(pool->mp_lock));
lam_mutex_unlock(&(pool->mp_lock));
return chunk;
}
@ -253,9 +253,7 @@ void *lam_mp_request_chunk(lam_mem_pool_t *pool, int pool_index)
if ( !chunk_found ) {
pool->mp_next_avail_chunk = pool->mp_num_chunks;
}
lam_mtx_unlock(&(pool->mp_lock));
lam_mutex_unlock(&(pool->mp_lock));
return chunk;
}

Просмотреть файл

@ -15,7 +15,7 @@ void lam_sgl_init(lam_seg_list_t *slist)
{
SUPER_INIT(slist, lam_seg_list_cls.cls_parent);
STATIC_INIT(slist->sgl_list, &lam_list_cls);
lam_mtx_init(&slist->sgl_lock);
lam_mutex_init(&slist->sgl_lock);
slist->sgl_min_bytes_pushed = 0;
slist->sgl_max_bytes_pushed = 0;
slist->sgl_bytes_pushed = 0;

Просмотреть файл

@ -39,8 +39,8 @@ void lam_sgl_append_elt_chunk(
*
*/
#define lam_sgl_lock_list(slist) lam_mtx_trylock(&slist->sgl_lock)
#define lam_sgl_unlock_list(slist) lam_mtx_unlock(&slist->sgl_lock)
#define lam_sgl_lock_list(slist) lam_mutex_trylock(&slist->sgl_lock)
#define lam_sgl_unlock_list(slist) lam_mutex_unlock(&slist->sgl_lock)
static inline bool lam_sgl_is_locked(lam_seg_list_t *slist);
static inline bool lam_sgl_is_locked(lam_seg_list_t *slist)
@ -48,9 +48,9 @@ static inline bool lam_sgl_is_locked(lam_seg_list_t *slist)
/* returns 1 if list is currently locked, otherwise 0. */
int ret;
ret = lam_mtx_trylock(&slist->sgl_lock);
ret = lam_mutex_trylock(&slist->sgl_lock);
if ( !ret )
lam_mtx_unlock(&slist->sgl_lock);
lam_mutex_unlock(&slist->sgl_lock);
return !ret;
}

Просмотреть файл

@ -75,7 +75,7 @@ lam_cmd_line_t *lam_cmd_line_create(void)
only thread that has this instance), there's no need to lock it
right now. */
lam_mtx_init(&cmd->lcl_mutex);
lam_mutex_init(&cmd->lcl_mutex);
/* Initialize the lists */
@ -120,7 +120,7 @@ int lam_cmd_line_free(lam_cmd_line_t *cmd)
#if 0
/* We don't lock the mutex; there's no point. Just free it. */
lam_mtx_free(&cmd->lcl_mutex);
lam_mutex_free(&cmd->lcl_mutex);
#endif
/* Free the lists */

Просмотреть файл

@ -146,10 +146,10 @@ static inline int lam_cmd_line_get_tail(lam_cmd_line_t *cmd, int *tailc,
char ***tailv)
{
if (NULL != cmd) {
lam_mtx_lock(&cmd->lcl_mutex);
lam_mutex_lock(&cmd->lcl_mutex);
*tailc = cmd->lcl_tail_argc;
*tailv = lam_argv_copy(cmd->lcl_tail_argv);
lam_mtx_unlock(&cmd->lcl_mutex);
lam_mutex_unlock(&cmd->lcl_mutex);
return LAM_SUCCESS;
} else {
return LAM_ERROR;

Просмотреть файл

@ -72,7 +72,7 @@ void lam_reactor_init(lam_reactor_t* r)
lam_obj_init(&r->r_base);
r->r_base.obj_class = &lam_reactor_cls;
lam_mtx_init(&r->r_mutex);
lam_mutex_init(&r->r_mutex);
lam_list_init(&r->r_active);
lam_list_init(&r->r_free);
lam_list_init(&r->r_pending);
@ -108,12 +108,12 @@ bool lam_reactor_insert(lam_reactor_t* r, int sd, lam_reactor_listener_t* listen
}
#endif
lam_mtx_lock(&r->r_mutex);
lam_mutex_lock(&r->r_mutex);
lam_reactor_descriptor_t *descriptor = (lam_reactor_descriptor_t*)lam_list_remove_first(&r->r_free);
if(descriptor == 0) {
descriptor = lam_reactor_get_descriptor(r, sd);
if(descriptor == 0) {
lam_mtx_unlock(&r->r_mutex);
lam_mutex_unlock(&r->r_mutex);
return false;
}
lam_list_append(&r->r_pending, &descriptor->rd_base);
@ -134,7 +134,7 @@ bool lam_reactor_insert(lam_reactor_t* r, int sd, lam_reactor_listener_t* listen
LAM_FD_SET(sd, &r->r_except_set);
}
r->r_changes++;
lam_mtx_unlock(&r->r_mutex);
lam_mutex_unlock(&r->r_mutex);
return true;
}
@ -148,11 +148,11 @@ bool lam_reactor_remove(lam_reactor_t* r, int sd, lam_reactor_listener_t* rl, in
}
#endif
lam_mtx_lock(&r->r_mutex);
lam_mutex_lock(&r->r_mutex);
lam_reactor_descriptor_t* descriptor = (lam_reactor_descriptor_t*)lam_fh_get_value_for_ikey(&r->r_hash, sd);
if(descriptor == 0) {
lam_err(("lam_reactor_remove(%d): descriptor not registered.\n", sd));
lam_mtx_unlock(&r->r_mutex);
lam_mutex_unlock(&r->r_mutex);
return false;
}
descriptor->rd_flags &= ~flags;
@ -169,7 +169,7 @@ bool lam_reactor_remove(lam_reactor_t* r, int sd, lam_reactor_listener_t* rl, in
LAM_FD_CLR(sd, &r->r_except_set);
}
r->r_changes++;
lam_mtx_unlock(&r->r_mutex);
lam_mutex_unlock(&r->r_mutex);
return true;
}
@ -204,9 +204,9 @@ void lam_reactor_dispatch(lam_reactor_t* r, int cnt, lam_fd_set_t* rset, lam_fd_
if(flags) cnt--;
}
lam_mtx_lock(&r->r_mutex);
lam_mutex_lock(&r->r_mutex);
if(r->r_changes == 0) {
lam_mtx_unlock(&r->r_mutex);
lam_mutex_unlock(&r->r_mutex);
return;
}
@ -246,7 +246,7 @@ void lam_reactor_dispatch(lam_reactor_t* r, int cnt, lam_fd_set_t* rset, lam_fd_
}
r->r_changes = 0;
lam_mtx_unlock(&r->r_mutex);
lam_mutex_unlock(&r->r_mutex);
}