本文整理汇总了C++中Lck_Lock函数的典型用法代码示例。如果您正苦于以下问题:C++ Lck_Lock函数的具体用法?C++ Lck_Lock怎么用?C++ Lck_Lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Lck_Lock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bes_conn_try
static int
bes_conn_try(const struct sess *sp, struct backend *bp)
{
int s;
Lck_Lock(&bp->mtx);
bp->refcount++;
bp->n_conn++; /* It mostly works */
Lck_Unlock(&bp->mtx);
s = -1;
assert(bp->ipv6 != NULL || bp->ipv4 != NULL);
/* release lock during stuff that can take a long time */
if (params->prefer_ipv6 && bp->ipv6 != NULL)
s = VBE_TryConnect(sp, PF_INET6, bp->ipv6, bp->ipv6len, bp);
if (s == -1 && bp->ipv4 != NULL)
s = VBE_TryConnect(sp, PF_INET, bp->ipv4, bp->ipv4len, bp);
if (s == -1 && !params->prefer_ipv6 && bp->ipv6 != NULL)
s = VBE_TryConnect(sp, PF_INET6, bp->ipv6, bp->ipv6len, bp);
if (s < 0) {
Lck_Lock(&bp->mtx);
bp->n_conn--;
bp->refcount--; /* Only keep ref on success */
Lck_Unlock(&bp->mtx);
}
return (s);
}
开发者ID:akrito,项目名称:Varnish-Least-Busy-Director,代码行数:30,代码来源:cache_backend.c
示例2: VBO_DerefBusyObj
void
VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
{
struct busyobj *bo;
struct objcore *oc = NULL;
unsigned r;
CHECK_OBJ_ORNULL(wrk, WORKER_MAGIC);
AN(pbo);
bo = *pbo;
*pbo = NULL;
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_ORNULL(bo->fetch_objcore, OBJCORE_MAGIC);
CHECK_OBJ_ORNULL(bo->fetch_obj, OBJECT_MAGIC);
if (bo->fetch_objcore != NULL) {
oc = bo->fetch_objcore;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
Lck_Lock(&oc->objhead->mtx);
assert(bo->refcount > 0);
r = --bo->refcount;
Lck_Unlock(&oc->objhead->mtx);
} else {
Lck_Lock(&bo->mtx);
assert(bo->refcount > 0);
r = --bo->refcount;
Lck_Unlock(&bo->mtx);
}
if (r)
return;
VSLb(bo->vsl, SLT_BereqAcct, "%ju %ju %ju %ju %ju %ju",
(uintmax_t)bo->acct.bereq_hdrbytes,
(uintmax_t)bo->acct.bereq_bodybytes,
(uintmax_t)(bo->acct.bereq_hdrbytes + bo->acct.bereq_bodybytes),
(uintmax_t)bo->acct.beresp_hdrbytes,
(uintmax_t)bo->acct.beresp_bodybytes,
(uintmax_t)(bo->acct.beresp_hdrbytes + bo->acct.beresp_bodybytes));
VSL_End(bo->vsl);
if (bo->fetch_objcore != NULL) {
AN(wrk);
(void)HSH_DerefObjCore(&wrk->stats, &bo->fetch_objcore);
}
VCL_Rel(&bo->vcl);
if (bo->vary != NULL)
free(bo->vary);
memset(&bo->refcount, 0,
sizeof *bo - offsetof(struct busyobj, refcount));
if (cache_param->bo_cache && wrk != NULL && wrk->nbo == NULL)
wrk->nbo = bo;
else
VBO_Free(&bo);
}
开发者ID:frustra,项目名称:Varnish-Cache,代码行数:60,代码来源:cache_busyobj.c
示例3: SES_Delete
void
SES_Delete(struct sess *sp)
{
struct acct *b = &sp->acct_ses;
struct sessmem *sm;
static char noaddr[] = "-";
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
sm = sp->mem;
CHECK_OBJ_NOTNULL(sm, SESSMEM_MAGIC);
AZ(sp->obj);
AZ(sp->vcl);
assert(!isnan(b->first));
assert(!isnan(sp->t_end));
if (sp->addr == NULL)
sp->addr = noaddr;
if (sp->port == NULL)
sp->port = noaddr;
VSL(SLT_StatSess, sp->id, "%s %s %.0f %ju %ju %ju %ju %ju %ju %ju",
sp->addr, sp->port, sp->t_end - b->first,
b->sess, b->req, b->pipe, b->pass,
b->fetch, b->hdrbytes, b->bodybytes);
if (sm->workspace != params->sess_workspace) {
free(sm);
sm = NULL;
} else {
/* Clean and prepare for reuse */
ses_setup(sm);
Lck_Lock(&ses_mem_mtx);
VTAILQ_INSERT_HEAD(&ses_free_mem[1 - ses_qp], sm, list);
Lck_Unlock(&ses_mem_mtx);
}
SES_ClearReqBodyCache(sp);
/* Update statistics */
Lck_Lock(&stat_mtx);
if (sm == NULL)
VSC_C_main->n_sess_mem--;
n_sess_rel++;
VSC_C_main->n_sess = n_sess_grab - n_sess_rel;
Lck_Unlock(&stat_mtx);
/* Try to precreate some ses-mem so the acceptor will not have to */
if (VSC_C_main->n_sess_mem < VSC_C_main->n_sess + 10) {
sm = ses_sm_alloc();
if (sm != NULL) {
ses_setup(sm);
Lck_Lock(&ses_mem_mtx);
VTAILQ_INSERT_HEAD(&ses_free_mem[1 - ses_qp], sm, list);
Lck_Unlock(&ses_mem_mtx);
}
}
}
开发者ID:wk8,项目名称:Varnish-Cache,代码行数:54,代码来源:cache_session.c
示例4: Pool_Task_Arg
int
Pool_Task_Arg(struct worker *wrk, task_func_t *func,
const void *arg, size_t arg_len)
{
struct pool *pp;
struct worker *wrk2;
int retval;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AN(arg);
AN(arg_len);
pp = wrk->pool;
CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
Lck_Lock(&pp->mtx);
wrk2 = pool_getidleworker(pp);
if (wrk2 != NULL) {
VTAILQ_REMOVE(&pp->idle_queue, &wrk2->task, list);
retval = 1;
} else {
wrk2 = wrk;
retval = 0;
}
Lck_Unlock(&pp->mtx);
AZ(wrk2->task.func);
assert(arg_len <= WS_Reserve(wrk2->aws, arg_len));
memcpy(wrk2->aws->f, arg, arg_len);
wrk2->task.func = func;
wrk2->task.priv = wrk2->aws->f;
if (retval)
AZ(pthread_cond_signal(&wrk2->cond));
return (retval);
}
开发者ID:wskuner,项目名称:Varnish-Cache,代码行数:34,代码来源:cache_pool.c
示例5: VDI_RecycleFd
void
VDI_RecycleFd(struct vbc **vbp)
{
struct backend *bp;
struct vbc *vc;
AN(vbp);
vc = *vbp;
*vbp = NULL;
CHECK_OBJ_NOTNULL(vc, VBC_MAGIC);
CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC);
assert(vc->fd >= 0);
bp = vc->backend;
VSLb(vc->vsl, SLT_BackendReuse, "%s", bp->display_name);
/* XXX: revisit this hack */
VSL_Flush(vc->vsl, 0);
vc->vsl = NULL;
Lck_Lock(&bp->mtx);
VSC_C_main->backend_recycle++;
VTAILQ_INSERT_HEAD(&bp->connlist, vc, list);
VBE_DropRefLocked(bp);
}
开发者ID:1HLtd,项目名称:Varnish-Cache,代码行数:26,代码来源:cache_dir.c
示例6: ban_cleantail
static void
ban_cleantail(void)
{
struct ban *b;
do {
Lck_Lock(&ban_mtx);
b = VTAILQ_LAST(&ban_head, banhead_s);
if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) {
if (b->flags & BANS_FLAG_COMPLETED)
VSC_C_main->bans_completed--;
if (b->flags & BANS_FLAG_OBJ)
VSC_C_main->bans_obj--;
if (b->flags & BANS_FLAG_REQ)
VSC_C_main->bans_req--;
VSC_C_main->bans--;
VSC_C_main->bans_deleted++;
VTAILQ_REMOVE(&ban_head, b, list);
VSC_C_main->bans_persisted_fragmentation +=
ban_len(b->spec);
ban_info(BI_DROP, b->spec, ban_len(b->spec));
} else {
b = NULL;
}
Lck_Unlock(&ban_mtx);
if (b != NULL)
BAN_Free(b);
} while (b != NULL);
}
开发者ID:daghf,项目名称:varnish-cache-oldfork,代码行数:29,代码来源:cache_ban_lurker.c
示例7: ban_lurker
ban_lurker(struct worker *wrk, void *priv)
{
struct vsl_log vsl;
volatile double d;
unsigned gen = ban_generation + 1;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AZ(priv);
VSL_Setup(&vsl, NULL, 0);
while (!ban_shutdown) {
d = ban_lurker_work(wrk, &vsl);
ban_cleantail();
if (DO_DEBUG(DBG_LURKER))
VSLb(&vsl, SLT_Debug, "lurker: sleep = %lf", d);
d += VTIM_real();
Lck_Lock(&ban_mtx);
if (gen == ban_generation) {
(void)Lck_CondWait(&ban_lurker_cond, &ban_mtx, d);
ban_batch = 0;
}
gen = ban_generation;
Lck_Unlock(&ban_mtx);
}
pthread_exit(0);
NEEDLESS_RETURN(NULL);
}
开发者ID:daghf,项目名称:varnish-cache-oldfork,代码行数:28,代码来源:cache_ban_lurker.c
示例8: VFP_GetStorage
struct storage *
VFP_GetStorage(struct busyobj *bo, ssize_t sz)
{
ssize_t l;
struct storage *st;
struct object *obj;
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
obj = bo->fetch_obj;
CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
st = VTAILQ_LAST(&obj->store, storagehead);
if (st != NULL && st->len < st->space)
return (st);
AN(bo->stats);
l = fetchfrag;
if (l == 0)
l = sz;
if (l == 0)
l = cache_param->fetch_chunksize;
st = STV_alloc(bo, l);
if (st == NULL) {
(void)VFP_Error(bo, "Could not get storage");
} else {
AZ(st->len);
Lck_Lock(&bo->mtx);
VTAILQ_INSERT_TAIL(&obj->store, st, list);
Lck_Unlock(&bo->mtx);
}
return (st);
}
开发者ID:estibi,项目名称:Varnish-Cache,代码行数:31,代码来源:cache_fetch_proc.c
示例9: VDI_RecycleFd
void
VDI_RecycleFd(struct worker *wrk, struct vbc **vbp)
{
struct backend *bp;
struct vbc *vc;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AN(vbp);
vc = *vbp;
*vbp = NULL;
CHECK_OBJ_NOTNULL(vc, VBC_MAGIC);
CHECK_OBJ_NOTNULL(vc->backend, BACKEND_MAGIC);
assert(vc->fd >= 0);
bp = vc->backend;
WSL(wrk, SLT_BackendReuse, vc->vsl_id, "%s", bp->display_name);
/*
* Flush the shmlog, so that another session reusing this backend
* will log chronologically later than our use of it.
*/
WSL_Flush(wrk, 0);
Lck_Lock(&bp->mtx);
VSC_C_main->backend_recycle++;
VTAILQ_INSERT_HEAD(&bp->connlist, vc, list);
VBE_DropRefLocked(bp);
}
开发者ID:drwilco,项目名称:varnish-cache-drwilco,代码行数:27,代码来源:cache_dir.c
示例10: MPL_Free
void
MPL_Free(struct mempool *mpl, void *item)
{
struct memitem *mi;
CHECK_OBJ_NOTNULL(mpl, MEMPOOL_MAGIC);
AN(item);
mi = (void*)((uintptr_t)item - sizeof(*mi));
CHECK_OBJ_NOTNULL(mi, MEMITEM_MAGIC);
memset(item, 0, mi->size);
Lck_Lock(&mpl->mtx);
mpl->vsc->frees++;
mpl->vsc->live = --mpl->live;
if (mi->size < *mpl->cur_size) {
mpl->vsc->toosmall++;
VTAILQ_INSERT_HEAD(&mpl->surplus, mi, list);
} else {
mpl->vsc->pool = ++mpl->n_pool;
mi->touched = mpl->t_now;
VTAILQ_INSERT_HEAD(&mpl->list, mi, list);
}
Lck_Unlock(&mpl->mtx);
}
开发者ID:1HLtd,项目名称:Varnish-Cache,代码行数:28,代码来源:cache_mempool.c
示例11: smu_alloc
static struct storage *
smu_alloc(const struct stevedore *st, size_t size)
{
struct smu *smu;
Lck_Lock(&smu_mtx);
VSC_C_main->sma_nreq++;
if (VSC_C_main->sma_nbytes + size > smu_max)
size = 0;
else {
VSC_C_main->sma_nobj++;
VSC_C_main->sma_nbytes += size;
VSC_C_main->sma_balloc += size;
}
Lck_Unlock(&smu_mtx);
if (size == 0)
return (NULL);
smu = umem_zalloc(sizeof *smu, UMEM_DEFAULT);
if (smu == NULL)
return (NULL);
smu->sz = size;
smu->s.priv = smu;
smu->s.ptr = umem_alloc(size, UMEM_DEFAULT);
XXXAN(smu->s.ptr);
smu->s.len = 0;
smu->s.space = size;
smu->s.fd = -1;
smu->s.stevedore = st;
smu->s.magic = STORAGE_MAGIC;
return (&smu->s);
}
开发者ID:Gavin-v,项目名称:varnish-cache,代码行数:33,代码来源:storage_umem.c
示例12: EXP_Insert
void
EXP_Insert(struct object *o)
{
struct objcore *oc;
struct objcore_head *lru;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
AN(o->objhead);
AN(ObjIsBusy(o));
assert(o->cacheable);
HSH_Ref(o);
CHECK_OBJ_NOTNULL(o->objcore, OBJCORE_MAGIC);
oc = o->objcore;
assert(o->entered != 0 && !isnan(o->entered));
o->last_lru = o->entered;
Lck_Lock(&exp_mtx);
assert(oc->timer_idx == BINHEAP_NOIDX);
(void)update_object_when(o);
binheap_insert(exp_heap, oc);
assert(oc->timer_idx != BINHEAP_NOIDX);
lru = STV_lru(o->objstore);
if (lru != NULL) {
VTAILQ_INSERT_TAIL(lru, oc, lru_list);
oc->flags |= OC_F_ONLRU;
}
Lck_Unlock(&exp_mtx);
if (o->smp_object != NULL)
SMP_TTLchanged(o);
}
开发者ID:akrito,项目名称:Varnish-Least-Busy-Director,代码行数:30,代码来源:cache_expire.c
示例13: VRT_DelDirector
void
VRT_DelDirector(VCL_BACKEND *bp)
{
struct vcl *vcl;
struct vcldir *vdir;
VCL_BACKEND d;
TAKE_OBJ_NOTNULL(d, bp, DIRECTOR_MAGIC);
vdir = d->vdir;
CHECK_OBJ_NOTNULL(vdir, VCLDIR_MAGIC);
vcl = vdir->vcl;
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
Lck_Lock(&vcl_mtx);
VTAILQ_REMOVE(&vcl->director_list, vdir, list);
Lck_Unlock(&vcl_mtx);
AZ(errno=pthread_rwlock_rdlock(&vcl->temp_rwl));
if (VCL_WARM(vcl))
VDI_Event(d, VCL_EVENT_COLD);
AZ(errno=pthread_rwlock_unlock(&vcl->temp_rwl));
if(vdir->methods->destroy != NULL)
vdir->methods->destroy(d);
free(vdir->cli_name);
FREE_OBJ(vdir->dir);
FREE_OBJ(vdir);
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:26,代码来源:cache_vrt_vcl.c
示例14: vbp_has_poked
static void
vbp_has_poked(struct vbp_target *vt)
{
unsigned i, j;
uint64_t u;
const char *logmsg;
char bits[10];
CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC);
/* Calculate exponential average */
if (vt->happy & 1) {
if (vt->rate < AVG_RATE)
vt->rate += 1.0;
vt->avg += (vt->last - vt->avg) / vt->rate;
}
i = 0;
#define BITMAP(n, c, t, b) bits[i++] = (vt->n & 1) ? c : '-';
#include "tbl/backend_poll.h"
#undef BITMAP
bits[i] = '\0';
u = vt->happy;
for (i = j = 0; i < vt->probe.window; i++) {
if (u & 1)
j++;
u >>= 1;
}
vt->good = j;
Lck_Lock(&vt->mtx);
if (vt->backend != NULL) {
if (vt->good >= vt->probe.threshold) {
if (vt->backend->healthy)
logmsg = "Still healthy";
else {
logmsg = "Back healthy";
vt->backend->health_changed = VTIM_real();
}
vt->backend->healthy = 1;
} else {
if (vt->backend->healthy) {
logmsg = "Went sick";
vt->backend->health_changed = VTIM_real();
} else
logmsg = "Still sick";
vt->backend->healthy = 0;
}
VSL(SLT_Backend_health, 0, "%s %s %s %u %u %u %.6f %.6f %s",
vt->backend->display_name, logmsg, bits,
vt->good, vt->probe.threshold, vt->probe.window,
vt->last, vt->avg, vt->resp_buf);
if (!vt->disable) {
AN(vt->backend->vsc);
vt->backend->vsc->happy = vt->happy;
}
}
Lck_Unlock(&vt->mtx);
}
开发者ID:BMDan,项目名称:Varnish-Cache,代码行数:60,代码来源:cache_backend_poll.c
示例15: VRT_rel_vcl
void
VRT_rel_vcl(VRT_CTX, struct vclref **refp)
{
struct vcl *vcl;
struct vclref *ref;
AN(refp);
ref = *refp;
*refp = NULL;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ref, VCLREF_MAGIC);
vcl = ctx->vcl;
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
assert(vcl == ref->vcl);
/* NB: A VCL may be released by a VMOD at any time, but it must happen
* after a warmup and before the end of a cooldown. The release may or
* may not happen while the same thread holds the temperature lock, so
* instead we check that all references are gone in VCL_Nuke.
*/
Lck_Lock(&vcl_mtx);
assert(!VTAILQ_EMPTY(&vcl->ref_list));
VTAILQ_REMOVE(&vcl->ref_list, ref, list);
vcl->nrefs--;
/* No garbage collection here, for the same reasons as in VCL_Rel. */
Lck_Unlock(&vcl_mtx);
FREE_OBJ(ref);
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:32,代码来源:cache_vrt_vcl.c
示例16: vbp_thread
vbp_thread(struct worker *wrk, void *priv)
{
vtim_real now, nxt;
struct vbp_target *vt;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AZ(priv);
Lck_Lock(&vbp_mtx);
while (1) {
now = VTIM_real();
vt = binheap_root(vbp_heap);
if (vt == NULL) {
nxt = 8.192 + now;
(void)Lck_CondWait(&vbp_cond, &vbp_mtx, nxt);
} else if (vt->due > now) {
nxt = vt->due;
vt = NULL;
(void)Lck_CondWait(&vbp_cond, &vbp_mtx, nxt);
} else {
binheap_delete(vbp_heap, vt->heap_idx);
vt->due = now + vt->interval;
if (!vt->running) {
vt->running = 1;
vt->task.func = vbp_task;
vt->task.priv = vt;
if (Pool_Task_Any(&vt->task, TASK_QUEUE_REQ))
vt->running = 0;
}
binheap_insert(vbp_heap, vt);
}
}
NEEDLESS(Lck_Unlock(&vbp_mtx));
NEEDLESS(return NULL);
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:34,代码来源:cache_backend_probe.c
示例17: EXP_Rearm
void
EXP_Rearm(const struct object *o)
{
struct objcore *oc;
CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
oc = o->objcore;
if (oc == NULL)
return;
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
Lck_Lock(&exp_mtx);
/*
* The hang-man might have this object of the binheap while
* tending to a timer. If so, we do not muck with it here.
*/
if (oc->timer_idx != BINHEAP_NOIDX && update_object_when(o)) {
/*
* XXX: this could possibly be optimized by shuffling
* XXX: up or down, but that leaves some very nasty
* XXX: corner cases, such as shuffling all the way
* XXX: down the left half, then back up the right half.
*/
assert(oc->timer_idx != BINHEAP_NOIDX);
binheap_delete(exp_heap, oc->timer_idx);
assert(oc->timer_idx == BINHEAP_NOIDX);
binheap_insert(exp_heap, oc);
assert(oc->timer_idx != BINHEAP_NOIDX);
}
Lck_Unlock(&exp_mtx);
if (o->smp_object != NULL)
SMP_TTLchanged(o);
}
开发者ID:akrito,项目名称:Varnish-Least-Busy-Director,代码行数:32,代码来源:cache_expire.c
示例18: vbp_task
vbp_task(struct worker *wrk, void *priv)
{
struct vbp_target *vt;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CAST_OBJ_NOTNULL(vt, priv, VBP_TARGET_MAGIC);
AN(vt->running);
AN(vt->req);
assert(vt->req_len > 0);
vbp_start_poke(vt);
vbp_poke(vt);
vbp_has_poked(vt);
VBP_Update_Backend(vt);
Lck_Lock(&vbp_mtx);
if (vt->running < 0) {
assert(vt->heap_idx == BINHEAP_NOIDX);
vbp_delete(vt);
} else {
vt->running = 0;
if (vt->heap_idx != BINHEAP_NOIDX) {
vt->due = VTIM_real() + vt->interval;
binheap_delete(vbp_heap, vt->heap_idx);
binheap_insert(vbp_heap, vt);
}
}
Lck_Unlock(&vbp_mtx);
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:30,代码来源:cache_backend_probe.c
示例19: sma_trim
static void
sma_trim(struct storage *s, size_t size)
{
struct sma_sc *sma_sc;
struct sma *sma;
void *p;
size_t delta;
CHECK_OBJ_NOTNULL(s, STORAGE_MAGIC);
CAST_OBJ_NOTNULL(sma, s->priv, SMA_MAGIC);
sma_sc = sma->sc;
assert(sma->sz == sma->s.space);
assert(size < sma->sz);
delta = sma->sz - size;
if (delta < 256)
return;
if ((p = realloc(sma->s.ptr, size)) != NULL) {
Lck_Lock(&sma_sc->sma_mtx);
sma_sc->sma_alloc -= delta;
sma_sc->stats->g_bytes -= delta;
sma_sc->stats->c_freed += delta;
if (sma_sc->sma_max != SIZE_MAX)
sma_sc->stats->g_space += delta;
sma->sz = size;
Lck_Unlock(&sma_sc->sma_mtx);
sma->s.ptr = p;
s->space = size;
}
}
开发者ID:BabyOnlineSG,项目名称:pkg-varnish,代码行数:30,代码来源:storage_malloc.c
示例20: VRT_ref_vcl
struct vclref *
VRT_ref_vcl(VRT_CTX, const char *desc)
{
struct vcl *vcl;
struct vclref* ref;
ASSERT_CLI();
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(desc);
AN(*desc);
vcl = ctx->vcl;
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
assert(VCL_WARM(vcl));
ALLOC_OBJ(ref, VCLREF_MAGIC);
AN(ref);
ref->vcl = vcl;
bprintf(ref->desc, "%s", desc);
Lck_Lock(&vcl_mtx);
VTAILQ_INSERT_TAIL(&vcl->ref_list, ref, list);
vcl->nrefs++;
Lck_Unlock(&vcl_mtx);
return (ref);
}
开发者ID:hermunn,项目名称:varnish-cache,代码行数:27,代码来源:cache_vrt_vcl.c
注:本文中的Lck_Lock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论