libvirt/src/util/virthreadjob.h
Jiri Denemark 956953884e Add support for tracking thread jobs
Each thread can use a thread local variable to keep the name of a job
which is currently running in the job.

The virThreadJobSetWorker API is supposed to be called once by any
thread which is used as a worker, i.e., it is waiting in a pool, woken
up to do a job, and returned back to the pool.

The virThreadJobSet/virThreadJobClear APIs are to be called at the
beginning/end of each job.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-03-25 10:00:53 +01:00

34 lines
1.1 KiB
C

/*
* virthreadjob.h: APIs for tracking job associated with current thread
*
* Copyright (C) 2013-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Author: Jiri Denemark <jdenemar@redhat.com>
*/
#ifndef __VIR_THREAD_JOB_H__
# define __VIR_THREAD_JOB_H__
const char *virThreadJobGet(void);
void virThreadJobSetWorker(const char *caller);
void virThreadJobSet(const char *caller);
void virThreadJobClear(int rv);
#endif