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 <cx/struct.h>
7#include "tqmonitor.h"
8#include <cx/thread/mutex.h>
9
10CX_C_BEGIN
11
12typedef struct TaskQueue TaskQueue;
13typedef struct TaskQueue_WeakRef TaskQueue_WeakRef;
14typedef struct TQThreadPoolMonitor TQThreadPoolMonitor;
15typedef struct TQThreadPoolMonitor_WeakRef TQThreadPoolMonitor_WeakRef;
16saDeclarePtr(TQThreadPoolMonitor);
17saDeclarePtr(TQThreadPoolMonitor_WeakRef);
18#define _sti_TQThreadPoolMonitor _sti_object
19#define SType_TQThreadPoolMonitor TQThreadPoolMonitor*
20#define STStorageType_TQThreadPoolMonitor TQThreadPoolMonitor*
21#define STypeArg_TQThreadPoolMonitor(type, val) stgeneric(object, (ObjInst*)objInstCheckClass(TQThreadPoolMonitor, val))
22#define STypeArgPtr_TQThreadPoolMonitor(type, val) (stgeneric*)objInstCheckClassPtr(TQThreadPoolMonitor, val)
23#define STypeCheckedArg_TQThreadPoolMonitor(type, val) stType(type), stArg(type, val)
24#define STypeCheckedPtrArg_TQThreadPoolMonitor(type, val) stType(type), stArgPtr(type, val)
25
26typedef struct TQThreadPoolMonitor_ClassIf {
27 ObjIface* _implements;
28 ObjIface* _parent;
29 size_t _size;
30
31 bool (*start)(_In_ void* self, _In_ TaskQueue* tq);
32 int64 (*tick)(_In_ void* self);
33 bool (*stop)(_In_ void* self);
34} TQThreadPoolMonitor_ClassIf;
35extern TQThreadPoolMonitor_ClassIf TQThreadPoolMonitor_ClassIf_tmpl;
36
37typedef struct TQThreadPoolMonitor {
38 union {
39 TQThreadPoolMonitor_ClassIf* _;
40 void* _is_TQThreadPoolMonitor;
41 void* _is_TQMonitor;
42 void* _is_ObjInst;
43 };
44 ObjClassInfo* _clsinfo;
45 atomic(uintptr) _ref;
46 atomic(ptr) _weakref;
47
48 TaskQueue* tq;
50 Mutex monitorlock;
51 int64 lastrun;
52 int64 lastwarn;
53} TQThreadPoolMonitor;
54extern ObjClassInfo TQThreadPoolMonitor_clsinfo;
55#define TQThreadPoolMonitor(inst) objInstCheckClass(TQThreadPoolMonitor, inst)
56#define TQThreadPoolMonitorNone ((TQThreadPoolMonitor*)NULL)
57
58typedef struct TQThreadPoolMonitor_WeakRef {
59 union {
60 ObjInst* _inst;
61 void* _is_TQThreadPoolMonitor_WeakRef;
62 void* _is_TQMonitor_WeakRef;
63 void* _is_ObjInst_WeakRef;
64 };
65 atomic(uintptr) _ref;
66 RWLock _lock;
67} TQThreadPoolMonitor_WeakRef;
68#define TQThreadPoolMonitor_WeakRef(inst) objWeakRefCheckClass(TQThreadPoolMonitor, inst)
69
70_objfactory_guaranteed TQThreadPoolMonitor* TQThreadPoolMonitor_create(_In_ TaskQueueMonitorConfig* config);
71// TQThreadPoolMonitor* tqthreadpoolmonitorCreate(TaskQueueMonitorConfig* config);
72#define tqthreadpoolmonitorCreate(config) TQThreadPoolMonitor_create(config)
73
74// bool tqthreadpoolmonitorStart(TQThreadPoolMonitor* self, TaskQueue* tq);
75#define tqthreadpoolmonitorStart(self, tq) (self)->_->start(TQThreadPoolMonitor(self), TaskQueue(tq))
76// int64 tqthreadpoolmonitorTick(TQThreadPoolMonitor* self);
77#define tqthreadpoolmonitorTick(self) (self)->_->tick(TQThreadPoolMonitor(self))
78// bool tqthreadpoolmonitorStop(TQThreadPoolMonitor* self);
79#define tqthreadpoolmonitorStop(self) (self)->_->stop(TQThreadPoolMonitor(self))
80
81CX_C_END
#define saDeclarePtr(name)
Definition sarray.h:100
#define _objfactory_guaranteed
Definition objimpl.h:106
CX Struct System - Introspectable, serializable POD structures in C.
Mutex synchronization primitive.
CX Object System - Object-oriented programming in C.
Definition mutex.h:60
Queue monitoring configuration for detecting stalled tasks.