CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
tqtpmonitor.h
1#pragma once
2// This header file is auto-generated!
3// Do not make changes to this file or they will be overwritten.
4// clang-format off
5#include <cx/obj.h>
6#include "tqmonitor.h"
7#include <cx/thread/mutex.h>
8
9typedef struct TaskQueue TaskQueue;
10typedef struct TaskQueue_WeakRef TaskQueue_WeakRef;
11typedef struct TQThreadPoolMonitor TQThreadPoolMonitor;
12typedef struct TQThreadPoolMonitor_WeakRef TQThreadPoolMonitor_WeakRef;
13saDeclarePtr(TQThreadPoolMonitor);
14saDeclarePtr(TQThreadPoolMonitor_WeakRef);
15
16typedef struct TQThreadPoolMonitor_ClassIf {
17 ObjIface* _implements;
18 ObjIface* _parent;
19 size_t _size;
20
21 bool (*start)(_In_ void* self, _In_ TaskQueue* tq);
22 int64 (*tick)(_In_ void* self);
23 bool (*stop)(_In_ void* self);
24} TQThreadPoolMonitor_ClassIf;
25extern TQThreadPoolMonitor_ClassIf TQThreadPoolMonitor_ClassIf_tmpl;
26
27typedef struct TQThreadPoolMonitor {
28 union {
29 TQThreadPoolMonitor_ClassIf* _;
30 void* _is_TQThreadPoolMonitor;
31 void* _is_TQMonitor;
32 void* _is_ObjInst;
33 };
34 ObjClassInfo* _clsinfo;
35 atomic(uintptr) _ref;
36 atomic(ptr) _weakref;
37
38 TaskQueue* tq;
40 Mutex monitorlock;
41 int64 lastrun;
42 int64 lastwarn;
43} TQThreadPoolMonitor;
44extern ObjClassInfo TQThreadPoolMonitor_clsinfo;
45#define TQThreadPoolMonitor(inst) ((TQThreadPoolMonitor*)(unused_noeval((inst) && &((inst)->_is_TQThreadPoolMonitor)), (inst)))
46#define TQThreadPoolMonitorNone ((TQThreadPoolMonitor*)NULL)
47
48typedef struct TQThreadPoolMonitor_WeakRef {
49 union {
50 ObjInst* _inst;
51 void* _is_TQThreadPoolMonitor_WeakRef;
52 void* _is_TQMonitor_WeakRef;
53 void* _is_ObjInst_WeakRef;
54 };
55 atomic(uintptr) _ref;
56 RWLock _lock;
57} TQThreadPoolMonitor_WeakRef;
58#define TQThreadPoolMonitor_WeakRef(inst) ((TQThreadPoolMonitor_WeakRef*)(unused_noeval((inst) && &((inst)->_is_TQThreadPoolMonitor_WeakRef)), (inst)))
59
60_objfactory_guaranteed TQThreadPoolMonitor* TQThreadPoolMonitor_create(_In_ TaskQueueMonitorConfig* config);
61// TQThreadPoolMonitor* tqthreadpoolmonitorCreate(TaskQueueMonitorConfig* config);
62#define tqthreadpoolmonitorCreate(config) TQThreadPoolMonitor_create(config)
63
64// bool tqthreadpoolmonitorStart(TQThreadPoolMonitor* self, TaskQueue* tq);
65#define tqthreadpoolmonitorStart(self, tq) (self)->_->start(TQThreadPoolMonitor(self), TaskQueue(tq))
66// int64 tqthreadpoolmonitorTick(TQThreadPoolMonitor* self);
67#define tqthreadpoolmonitorTick(self) (self)->_->tick(TQThreadPoolMonitor(self))
68// bool tqthreadpoolmonitorStop(TQThreadPoolMonitor* self);
69#define tqthreadpoolmonitorStop(self) (self)->_->stop(TQThreadPoolMonitor(self))
70
#define saDeclarePtr(name)
Definition sarray.h:98
#define _objfactory_guaranteed
Definition objimpl.h:104
Mutex synchronization primitive.
CX Object System - Object-oriented programming in C.
Definition mutex.h:60
Queue monitoring configuration for detecting stalled tasks.