Files
pip/libs/main/introspection/piintrospection_threads.h
2022-12-14 14:13:52 +03:00

73 lines
2.6 KiB
C++

/*
PIP - Platform Independent Primitives
Introspection module - interface for threads
Ivan Pelipenko peri4ko@yandex.ru
This program 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 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIINTROSPECTION_THREADS_H
#define PIINTROSPECTION_THREADS_H
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
# include "piintrospection_base.h"
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)
// clang-format off
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);
// clang-format on
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