Files
pip/src_main/introspection/piintrospection_threads.h

72 lines
2.5 KiB
C++

/*
PIP - Platform Independent Primitives
Introspection module - interface for threads
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIINTROSPECTION_THREADS_H
#define PIINTROSPECTION_THREADS_H
#include "piintrospection_base.h"
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
class PIIntrospectionThreads;
#define PIINTROSPECTION_THREADS (PIIntrospectionThreadsInterface::instance())
# define PIINTROSPECTION_THREAD_NEW(t) PIINTROSPECTION_THREADS->threadNew (t);
# define PIINTROSPECTION_THREAD_DELETE(t) PIINTROSPECTION_THREADS->threadDelete (t);
# define PIINTROSPECTION_THREAD_START(t) PIINTROSPECTION_THREADS->threadStart (t);
# define PIINTROSPECTION_THREAD_RUN(t) PIINTROSPECTION_THREADS->threadRun (t);
# define PIINTROSPECTION_THREAD_WAIT(t) PIINTROSPECTION_THREADS->threadWait (t);
# define PIINTROSPECTION_THREAD_STOP(t) PIINTROSPECTION_THREADS->threadStop (t);
# define PIINTROSPECTION_THREAD_RUN_DONE(t,us) PIINTROSPECTION_THREADS->threadRunDone(t,us);
class PIP_EXPORT PIIntrospectionThreadsInterface {
friend class PIIntrospection;
public:
__PIINTROSPECTION_SINGLETON_H__(Threads)
void threadNew (PIThread * t);
void threadDelete (PIThread * t);
void threadStart (PIThread * t);
void threadRun (PIThread * t);
void threadWait (PIThread * t);
void threadStop (PIThread * t);
void threadRunDone(PIThread * t, ullong us);
private:
PIIntrospectionThreadsInterface();
~PIIntrospectionThreadsInterface();
PIIntrospectionThreads * p;
};
#else
# define PIINTROSPECTION_THREAD_NEW(t)
# define PIINTROSPECTION_THREAD_DELETE(t)
# define PIINTROSPECTION_THREAD_START(t)
# define PIINTROSPECTION_THREAD_RUN(t)
# define PIINTROSPECTION_THREAD_WAIT(t)
# define PIINTROSPECTION_THREAD_STOP(t)
# define PIINTROSPECTION_THREAD_RUN_DONE(t,us)
#endif
#endif // PIINTROSPECTION_THREADS_H