Exemplo n.º 1
0
void
isrwlocked(Memblk *f, int iswr)
{
	if(f->type != DBfile || f->mf == nil)
		fatal("isrwlocked: not a file  at pc %#p", getcallerpc(&f));
	if((iswr && canrlock(f->mf)) || (!iswr && canwlock(f->mf)))
		fatal("is%clocked at pc %#p", iswr?'w':'r', getcallerpc(&f));
}
Exemplo n.º 2
0
/*
 * f->source and f->msource must NOT be locked.
 * fileMetaFlush locks the fileMeta and then the source (in fileMetaFlush2).
 * We have to respect that ordering.
 */
static void
fileMetaLock(File *f)
{
if(f->up == nil)
fprint(2, "f->elem = %s\n", f->dir.elem);
	assert(f->up != nil);
	assert(!canwlock(&f->fs->elk));
	wlock(&f->up->lk);
}
Exemplo n.º 3
0
RWLock::~RWLock()
{
#if defined(__BEOS__) || defined(__HAIKU__)
    // TODO
#elif defined(USE_LIBTASK)
    ASSERT(canwlock(&m_rwlock));
#else
    int r = pthread_rwlock_destroy(&m_rwlock);
    ASSERT(r == 0);
#endif
}
Exemplo n.º 4
0
static int
fileLock(File *f)
{
	assert(!canwlock(&f->fs->elk));
	wlock(&f->lk);
	if(!chkSource(f)){
		fileUnlock(f);
		return 0;
	}
	return 1;
}