Ejemplo n.º 1
0
Archivo: devcons.c Proyecto: 8l/inferno
static Chan*
consopen(Chan *c, int omode)
{
	c = devopen(c, omode, contab, nelem(contab), devgen);
	switch((ulong)c->qid.path) {
	case Qconsctl:
		incref(&kbd.ctl);
		break;

	case Qscancode:
		qlock(&kbd.gq);
		if(gkscanq != nil || gkscanid == nil) {
			qunlock(&kbd.q);
			c->flag &= ~COPEN;
			if(gkscanq)
				error(Einuse);
			else
				error("not supported");
		}
		gkscanq = qopen(256, 0, nil, nil);
		qunlock(&kbd.gq);
		break;

	case Qkprint:
		wlock(&kprintq.l);
		if(waserror()){
			wunlock(&kprintq.l);
			c->flag &= ~COPEN;
			nexterror();
		}
		if(kprintq.q != nil)
			error(Einuse);
		kprintq.q = qopen(32*1024, Qcoalesce, nil, nil);
		if(kprintq.q == nil)
			error(Enomem);
		qnoblock(kprintq.q, 1);
		poperror();
		wunlock(&kprintq.l);
		c->iounit = qiomaxatomic;
		break;
	case Qevents:
		c->aux = qopen(512, 0, nil, nil);
		add_listener(&event_listeners, c->aux);
		break;
	}
	return c;
}
Ejemplo n.º 2
0
void Config::recordQueryPerformance(const std::string& name,
                                    size_t delay,
                                    size_t size,
                                    const Row& r0,
                                    const Row& r1) {
  WriteLock wlock(config_performance_mutex_);
  if (performance_.count(name) == 0) {
    performance_[name] = QueryPerformance();
  }

  // Grab access to the non-const schedule item.
  auto& query = performance_.at(name);
  BIGINT_LITERAL diff = 0;
  if (!r1.at("user_time").empty() && !r0.at("user_time").empty()) {
    diff = AS_LITERAL(BIGINT_LITERAL, r1.at("user_time")) -
           AS_LITERAL(BIGINT_LITERAL, r0.at("user_time"));
    if (diff > 0) {
      query.user_time += diff;
    }
  }

  if (!r1.at("system_time").empty() && !r0.at("system_time").empty()) {
    diff = AS_LITERAL(BIGINT_LITERAL, r1.at("system_time")) -
           AS_LITERAL(BIGINT_LITERAL, r0.at("system_time"));
    if (diff > 0) {
      query.system_time += diff;
    }
  }

  if (!r1.at("resident_size").empty() && !r0.at("resident_size").empty()) {
    diff = AS_LITERAL(BIGINT_LITERAL, r1.at("resident_size")) -
           AS_LITERAL(BIGINT_LITERAL, r0.at("resident_size"));
    if (diff > 0) {
      // Memory is stored as an average of RSS changes between query executions.
      query.average_memory = (query.average_memory * query.executions) + diff;
      query.average_memory = (query.average_memory / (query.executions + 1));
    }
  }

  query.wall_time += delay;
  query.output_size += size;
  query.executions += 1;
  query.last_executed = getUnixTime();

  // Clear the executing query (remove the dirty bit).
  setDatabaseValue(kPersistentSettings, kExecutingQuery, "");
}
Ejemplo n.º 3
0
void testObj::test<5>(void)
{
  WaitingLockData     wld;
  volatile int        state=0;
  auto_ptr<WriteLock> wlock( new WriteLock(mutexRW_) );
  assert( wlock.get()!=NULL );
  TestThread          tt(&wld, &state, &mutexRW_);
  thread              th(tt);
  // wait for thread a little
  const TimeoutChecker tc(5, "timed out while waiting for state to change");
  while( state!=1 && tc() )
    boost::thread::yield();
  // release lock by setting new value
  wld.setPtr( leaf_.shared_ptr() );
  // join - if call exited, thread will join cleanly
  th.join();
}
Ejemplo n.º 4
0
static int report_title(const char *fmt,...)
{
	int len = 0;
	if ( report_fp )
	{
		wlock(&report_lock);
		if ( report_cols++>0 )
			len = fprintf(report_fp,"%s",report_eol);
		va_list ptr;
		va_start(ptr,fmt);
		len = +vfprintf(report_fp,fmt,ptr);
		va_end(ptr);
		fflush(report_fp);
		wunlock(&report_lock);
	}
	return len;
}
Ejemplo n.º 5
0
bool WorldDownloadManager::lockKinfu()
{
  boost::mutex::scoped_lock wlock(m_kinfu_waiting_mutex);
  m_kinfu_waiting_count++;

  // wake up the kinfu thread, so "respond" may be called
  m_shared_cond.notify_one();

  while (!m_kinfu_available && !m_is_shutting_down)
    m_kinfu_waiting_cond.wait(wlock);

  if (m_is_shutting_down)
    return false;

  m_kinfu_available = false;
  return true;
}
Ejemplo n.º 6
0
/*
 *  detach a device from an interface, close the interface
 *  called with ifc->conv closed
 */
static char*
ipifcunbind(Ipifc *ifc)
{
	Proc *up = externup();
	char *err;

	if(waserror()){
		wunlock(ifc);
		nexterror();
	}
	wlock(ifc);

	/* dissociate routes */
	if(ifc->medium != nil && ifc->medium->unbindonclose == 0)
		ifc->conv->inuse--;
	ifc->ifcid++;

	/* disassociate logical interfaces (before zeroing ifc->arg) */
	while(ifc->lifc){
		err = ipifcremlifc(ifc, ifc->lifc);
		/*
		 * note: err non-zero means lifc not found,
		 * which can't happen in this case.
		 */
		if(err)
			error(err);
	}

	/* disassociate device */
	if(ifc->medium && ifc->medium->unbind)
		(*ifc->medium->unbind)(ifc);
	memset(ifc->dev, 0, sizeof(ifc->dev));
	ifc->arg = nil;
	ifc->reassemble = 0;

	/* close queues to stop queuing of packets */
	qclose(ifc->conv->rq);
	qclose(ifc->conv->wq);
	qclose(ifc->conv->sq);

	ifc->medium = nil;
	wunlock(ifc);
	poperror();
	return nil;
}
Ejemplo n.º 7
0
void
consinit(void)
{
	int i;

	cons.chan = ialloc(sizeof(Chan));
	wlock(&cons.chan->reflock);
	wunlock(&cons.chan->reflock);
	lock(&cons.chan->flock);
	unlock(&cons.chan->flock);
	dofilter(&cons.work);
	dofilter(&cons.rate);
	dofilter(&cons.bhit);
	dofilter(&cons.bread);
	dofilter(&cons.binit);
	for(i = 0; i < MAXTAG; i++)
		dofilter(&cons.tags[i]);
}
Ejemplo n.º 8
0
int main(){
    printf("进程标识(PID): %d\n",getpid());
    int fd = open("lock.txt",O_RDWR | O_CREAT | O_TRUNC,0664);
    if(fd == -1){
        perror("open");
        return -1;
    }
    const char* text = "ABCDEFGHIJKLMNOPQR";
    if(write(fd,text,strlen(text) * sizeof(text[0])) == -1){
        perror("write");
        return -1;
    }
    //对EFGH加读锁
    printf("对EFGH加读锁");
    //文件头从0开始
    if(rlock(fd,4,4,0) == -1){
        printf("失败:%m\n");
        return -1;
    }
    printf("成功!\n");
    //对MNOP加写锁
    printf("对MNOP加写锁");
    if(wlock(fd,12,4,0) == -1){
        printf("失败:%m\n");
        return -1;
    }
    printf("成功!\n");
    printf("按<回车>,解锁MN...");
    getchar();
    //解锁MN
    ulock(fd,12,2);
    printf("按<回车>,解锁EFGH...");
    getchar();
    //解锁EFGH
    ulock(fd,4,4);
    /**
     * 只要文件描述符一关,什么锁就都没有了。系统内核会自动为你解锁,文件表会被删掉
     * 你加的锁也会从v节点表的锁的链表中删掉
     * 因为只要文件描述符一关,文件描述符和文件指针的对应就会被删掉,
     * 文件表也就没有了,对应v节点表中的锁的链表也就没有了
     */
    close(fd);
    return 0;
}
Ejemplo n.º 9
0
static Chan*
envopen(Chan *c, int omode)
{
	Egrp *eg;
	Evalue *e;
	int trunc;

	eg = envgrp(c);
	if(c->qid.type & QTDIR) {
		if(omode != OREAD)
			error(Eperm);
	}
	else {
		trunc = omode & OTRUNC;
		if(omode != OREAD && !envwriteable(c))
			error(Eperm);
		if(trunc)
			wlock(&eg->rwl);
		else
			rlock(&eg->rwl);
		e = envlookup(eg, nil, c->qid.path);
		if(e == 0) {
			if(trunc)
				wunlock(&eg->rwl);
			else
				runlock(&eg->rwl);
			error(Enonexist);
		}
		if(trunc && e->value) {
			e->qid.vers++;
			free(e->value);
			e->value = 0;
			e->len = 0;
		}
		if(trunc)
			wunlock(&eg->rwl);
		else
			runlock(&eg->rwl);
	}
	c->mode = openmode(omode);
	c->flag |= COPEN;
	c->offset = 0;
	return c;
}
Ejemplo n.º 10
0
Document *Cache::get( const Key &key )
{
	Status::cacheReqRetain();

	wlock();
	Document *doc = data[key.str()];
	if ( doc && list.front() != doc )
	{
		std::list<Document*>::iterator it = std::find( list.begin(), list.end(), doc );
		list.erase( it );
		list.push_front( doc );
	}
	unlock();

	if ( doc )
		Status::cacheHitRetain();

	return doc;
}
Ejemplo n.º 11
0
Archivo: io.c Proyecto: bhanug/harvey
void
voidcache(int n)
{
	Wcache *c;

	rlock(&cachelock);
	if(c = findcache(n)){
		wlock(c);
		c->tcurrent = 0;
		c->thist = 0;
		/* aggressively free memory */
		closewhist(c->hist);
		c->hist = nil;
		closewhist(c->current);
		c->current = nil;
		wunlock(c);
	}
	runlock(&cachelock);
}
Ejemplo n.º 12
0
void FileServerHandler::connectionAnnounced(MythSocket *socket,
                                QStringList &commands, QStringList &slist)
{
    if (commands[1] == "SlaveBackend")
    {
        // were not going to handle these, but we still want to track them
        // for commands that need access to these sockets
        if (slist.size() >= 3)
        {
            SocketHandler *handler = m_parent->GetConnectionBySocket(socket);
            if (handler == NULL)
                return;

            QWriteLocker wlock(&m_fsLock);
            m_fsMap.insert(commands[2], handler);
        }
    }

}
Ejemplo n.º 13
0
HRESULT SystemProperties::getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO)
{
    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);

    if (m->strDefaultAdditionsISO.isEmpty())
    {
        /* no guest additions, check if it showed up in the mean time */
        alock.release();
        {
            AutoWriteLock wlock(this COMMA_LOCKVAL_SRC_POS);
            ErrorInfoKeeper eik;
            (void)setDefaultAdditionsISO("");
        }
        alock.acquire();
    }
    aDefaultAdditionsISO = m->strDefaultAdditionsISO;

    return S_OK;
}
Ejemplo n.º 14
0
static long
envwrite(Chan *c, void *a, long n, vlong off)
{
	char *s;
	ulong len;
	Egrp *eg;
	Evalue *e;
	ulong offset = off;

	if(n <= 0)
		return 0;
	if(offset > Maxenvsize || n > (Maxenvsize - offset))
		error(Etoobig);

	eg = envgrp(c);
	wlock(eg);
	if(waserror()){
		wunlock(eg);
		nexterror();
	}

	e = envlookup(eg, nil, c->qid.path);
	if(e == nil)
		error(Enonexist);

	len = offset+n;
	if(len > e->len) {
		s = realloc(e->value, len);
		if(s == nil)
			error(Enomem);
		memset(s+offset, 0, n);
		e->value = s;
		e->len = len;
	}
	memmove(e->value+offset, a, n);
	e->qid.vers++;
	eg->vers++;

	wunlock(eg);
	poperror();
	return n;
}
Ejemplo n.º 15
0
        void renew()
        {
            com::xiaonei::xce::Statement sql;
            sql << "SELECT * FROM " << TABLE_CONFIG;

            std::map<std::string, ConfigItemPtr> config; 
            
            BatchDbResultHandler handler(config); 
            com::xiaonei::xce::QueryRunner(DB_CONFIG, com::xiaonei::xce::CDbRServer).query(sql, handler); 
            
            std::vector<std::string> vecStr;
            for(std::map<std::string, ConfigItemPtr>::const_iterator it = config.begin(); it != config.end(); ++it) {
                vecStr.push_back(it->first);
            } 
            if(!config.empty()) {
                IceUtil::RWRecMutex::WLock wlock(rwMutex_);
                config_.swap(config);
                dbTableVec_.swap(vecStr);
            }
        }
Ejemplo n.º 16
0
void Cache::flush()
{
	wlock();
	while ( list.size() > 0 )
	{
		Document *doc = list.back();
		list.pop_back();

		doc->wlock();
		if ( doc->changed() )
			doc->save();
		doc->unlock();
		delete doc;
		Status::cacheOutRetain();
	}
	list.clear();
	data.clear();
	seq++;
	unlock();
}
Ejemplo n.º 17
0
void Cache::flushLast()
{
	wlock();
	Document *doc = list.back();
	if ( doc != NULL )
	{
		list.pop_back();
		data.erase( doc->getKey().str() );

		doc->wlock();
		if ( doc->changed() )
			doc->save();
		doc->unlock();
		delete doc;
		Status::cacheOutRetain();

		seq++;
	}
	unlock();
}
Ejemplo n.º 18
0
PendingCollection::LockedPtr PendingCollection::lockAndWait(
    std::chrono::milliseconds timeoutms,
    bool& pinged) {
  auto lock = wlock();

  if (lock->checkAndResetPinged()) {
    pinged = true;
    return lock;
  }

  if (timeoutms.count() == -1) {
    cond_.wait(lock.getUniqueLock());
  } else {
    cond_.wait_for(lock.getUniqueLock(), timeoutms);
  }

  pinged = lock->checkAndResetPinged();

  return lock;
}
Ejemplo n.º 19
0
Archivo: ipifc.c Proyecto: 7perl/akaros
/*
 *  remove a multicast address from an interface, called with c locked
 */
void ipifcremmulti(struct conv *c, uint8_t * ma, uint8_t * ia)
{
	ERRSTACK(1);
	struct Ipmulti *multi, **l;
	struct Iplifc *lifc;
	struct conv **p;
	struct Ipifc *ifc;
	struct Fs *f;

	f = c->p->f;

	for (l = &c->multi; *l; l = &(*l)->next)
		if (ipcmp(ma, (*l)->ma) == 0)
			if (ipcmp(ia, (*l)->ia) == 0)
				break;

	multi = *l;
	if (multi == NULL)
		return;	/* we don't have it open */

	*l = multi->next;

	for (p = f->ipifc->conv; *p; p++) {
		if ((*p)->inuse == 0)
			continue;

		ifc = (struct Ipifc *)(*p)->ptcl;
		if (waserror()) {
			wunlock(&ifc->rwlock);
			nexterror();
		}
		wlock(&ifc->rwlock);
		for (lifc = ifc->lifc; lifc; lifc = lifc->next)
			if (ipcmp(ia, lifc->local) == 0)
				remselfcache(f, ifc, lifc, ma);
		wunlock(&ifc->rwlock);
		poperror();
	}

	kfree(multi);
}
Ejemplo n.º 20
0
/*
 *  remove a multicast address from an interface, called with c->car locked
 */
void
ipifcremmulti(Conv *c, uint8_t *ma, uint8_t *ia)
{
	Proc *up = externup();
	Ipmulti *multi, **l;
	Iplifc *lifc;
	Conv **p;
	Ipifc *ifc;
	Fs *f;

	f = c->p->f;

	for(l = &c->multi; *l; l = &(*l)->next)
		if(ipcmp(ma, (*l)->ma) == 0 && ipcmp(ia, (*l)->ia) == 0)
			break;

	multi = *l;
	if(multi == nil)
		return; 	/* we don't have it open */

	*l = multi->next;

	for(p = f->ipifc->conv; *p; p++){
		if((*p)->inuse == 0)
			continue;

		ifc = (Ipifc*)(*p)->ptcl;
		if(waserror()){
			wunlock(ifc);
			nexterror();
		}
		wlock(ifc);
		for(lifc = ifc->lifc; lifc; lifc = lifc->next)
			if(ipcmp(ia, lifc->local) == 0)
				remselfcache(f, ifc, lifc, ma);
		wunlock(ifc);
		poperror();
	}

	free(multi);
}
Ejemplo n.º 21
0
Archivo: devcons.c Proyecto: 8l/inferno
static void
consclose(Chan *c)
{
	if((c->flag&COPEN) == 0)
		return;

	switch((ulong)c->qid.path){
	case Qconsctl:
		/* last close of control file turns off raw */
		qlock(&kbd);
		if(--kbd.ctl == 0)
			kbd.raw = 0;
		qunlock(&kbd);
		break;

	case Qkeyboard:
		if(c->mode != OWRITE) {
			qlock(&kbd);
			--kbd.kbdr;
			qunlock(&kbd);
		}
		break;

	case Qscancode:
		qlock(&kbd);
		if(kscanq) {
			qfree(kscanq);
			kscanq = 0;
		}
		qunlock(&kbd);
		break;

	case Qkprint:
		wlock(&kprintq);
		qfree(kprintq.q);
		kprintq.q = nil;
		wunlock(&kprintq);
		break;
	}
}
Ejemplo n.º 22
0
Archivo: ipifc.c Proyecto: 7perl/akaros
/*
 *  detach a device from an interface, close the interface
 *  called with ifc->conv closed
 */
static char *ipifcunbind(struct Ipifc *ifc)
{
	ERRSTACK(1);
	char *err;

	if (waserror()) {
		wunlock(&ifc->rwlock);
		nexterror();
	}
	wlock(&ifc->rwlock);

	/* dissociate routes */
	if (ifc->m != NULL && ifc->m->unbindonclose == 0)
		ifc->conv->inuse--;
	ifc->ifcid++;

	/* disassociate device */
	if (ifc->m != NULL && ifc->m->unbind)
		(*ifc->m->unbind) (ifc);
	memset(ifc->dev, 0, sizeof(ifc->dev));
	ifc->arg = NULL;
	ifc->reassemble = 0;

	/* close queues to stop queuing of packets */
	qclose(ifc->conv->rq);
	qclose(ifc->conv->wq);
	qclose(ifc->conv->sq);

	/* disassociate logical interfaces */
	while (ifc->lifc) {
		err = ipifcremlifc(ifc, ifc->lifc);
		if (err)
			error(err);
	}

	ifc->m = NULL;
	wunlock(&ifc->rwlock);
	poperror();
	return NULL;
}
Ejemplo n.º 23
0
void FeedMcProxyConsumer::update(const string& shard, const vector<string>& endpoints) {
	MCE_INFO("FeedMcProxyConsumer::update --> shard:" << shard);
  vector<string> tmp(endpoints);

  boost::unique_lock<boost::shared_mutex> wlock(mutex_);
  map<string, vector<string> >::iterator it = endpoints_.find(shard);
  if (it != endpoints_.end()) {
 	  it->second.swap(tmp);
		if (!it->second.empty()) {
			try {
				string endpoints;
				for (size_t i = 0; i<it->second.size(); ++i) {
					endpoints += it->second[i] + ";";
				}
				LoadCluster(it->first,endpoints);
			} catch(std::exception& e) {
				MCE_WARN("FeedMcProxyConsumer::update -->err," << e.what());
				}
		}

  }
}
Ejemplo n.º 24
0
static void
envremove(Chan *c)
{
	Egrp *eg;
	Evalue *e;

	if(c->qid.type & QTDIR || !envwriteable(c))
		error(Eperm);

	eg = envgrp(c);
	wlock(eg);
	e = envlookup(eg, nil, c->qid.path);
	if(e == nil){
		wunlock(eg);
		error(Enonexist);
	}
	free(e->name);
	free(e->value);
	*e = eg->ent[--eg->nent];
	eg->vers++;
	wunlock(eg);
}
Ejemplo n.º 25
0
Archivo: sub.c Proyecto: npe9/harvey
void
devrecover(Device *d)
{
	for (;;) {
		print("recover: %Z\n", d);
		switch(d->type) {
		default:
			print("recover: unknown dev type %Z\n", d);
			return;

		case Devcw:
			wlock(&mainlock);	/* recover */
			cwrecover(d);
			wunlock(&mainlock);
			return;

		case Devswab:
			d = d->swab.d;
			break;
		}
	}
}
Ejemplo n.º 26
0
int
caninsertkey(Intmap *map, ulong id, void *v)
{
	Intlist *f;
	int rv;
	ulong h;

	wlock(map);
	if(*llookup(map, id))
		rv = 0;
	else{
		f = emalloc9p(sizeof *f);
		f->id = id;
		f->aux = v;
		h = hashid(id);
		f->link = map->hash[h];
		map->hash[h] = f;
		rv = 1;
	}
	wunlock(map);
	return rv;	
}
Ejemplo n.º 27
0
static int32_t
envwrite(Chan *c, void *a, int32_t n, int64_t off)
{
	char *s;
	Egrp *eg;
	Evalue *e;
	int32_t len, offset;

	if(n <= 0)
		return 0;
	offset = off;
	if(offset > Maxenvsize || n > (Maxenvsize - offset))
		error(Etoobig);

	eg = envgrp(c);
	wlock(&eg->rwl);
	e = envlookup(eg, nil, c->qid.path);
	if(e == 0) {
		wunlock(&eg->rwl);
		error(Enonexist);
	}

	len = offset+n;
	if(len > e->len) {
		s = smalloc(len);
		if(e->value){
			memmove(s, e->value, e->len);
			free(e->value);
		}
		e->value = s;
		e->len = len;
	}
	memmove(e->value+offset, a, n);
	e->qid.vers++;
	eg->vers++;
	wunlock(&eg->rwl);
	return n;
}
Ejemplo n.º 28
0
void Cache::push( const Key &key, Document *datum, bool ignoreExists )
{
	Status::cacheInRetain();

	wlock();
	Document *check = data[key.str()];
	if ( check != NULL )
	{
		if ( ignoreExists )
		{
			LLOG
			delete check;
			Status::cacheOutRetain();
			//check->destroy();
		}
		else
			throw std::runtime_error( "Data is current exists." );
	}
	data[key.str()] = datum;
	seq++;

	list.push_front( datum );
	if ( data.size() > Cache::perCountLimit )
	{
		Document *oldest = list.back();
		if ( oldest != NULL )
		{
			list.pop_back();

			oldest->save();
			data.erase( oldest->getKey().str() );
			delete oldest;

			Status::cacheOutRetain();
		}
	}
	unlock();
}
Ejemplo n.º 29
0
/** Establish the default timezone for time conversion.
	\p NULL \p tzname uses \p TZ environment for default
 **/
char *timestamp_set_tz(char *tz_name)
{
	if (tz_name == NULL){
		tz_name=getenv("TZ");
	}

	if(tz_name == NULL)
	{
		static char guess[64];
		static unsigned int tzlock=0;

		if (strcmp(_tzname[0], "") == 0){
			THROW("timezone not identified");
			/* TROUBLESHOOT
				An attempt to use timezones was made before the timezome has been specified.  Try adding or moving the
				timezone spec to the top of the <code>clock</code> directive and try again.  Alternatively, you can set the '''TZ''' environment
				variable.

			 */
		}

		wlock(&tzlock);
		if (_timezone % 60 == 0){
			sprintf(guess, "%s%d%s", _tzname[0], (int)(_timezone / 3600), _daylight?_tzname[1]:"");
		} else {
			sprintf(guess, "%s%d:%d%s", _tzname[0], (int)(_timezone / 3600), (int)(_timezone / 60), _daylight?_tzname[1]:"");
		}
		if (_timezone==0 && _daylight==0)
			tz_name="UTC0";
		else
			tz_name = guess;
		wunlock(&tzlock);
	}

	load_tzspecs(tz_name);

	return current_tzname;
}
Ejemplo n.º 30
0
static bool report_open(void)
{
	wlock(&report_lock);

	global_getvar("validate_report",report_file,sizeof(report_file));
	if ( report_fp==NULL )
	{
		report_ext = strrchr(report_file,'.');
		if ( strcmp(report_ext,".csv")==0 ) 
		{
			report_col = ",";
			report_eot = "\n";
		}
		else if ( strcmp(report_ext,".txt")==0) 
		{
			report_col = "\t";
			report_eot = "\n";
		}
		report_fp = fopen(report_file,"w");
	}
	wunlock(&report_lock);
	return report_fp!=NULL;
}