CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
threadobj.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/stype/stvar.h>
8#include <cx/thread/atomic.h>
9#include <cx/thread/event.h>
10#include <cx/thread/threadbase.h>
11
12typedef struct Thread Thread;
13typedef struct Thread_WeakRef Thread_WeakRef;
14saDeclarePtr(Thread);
15saDeclarePtr(Thread_WeakRef);
16
17typedef struct Thread {
18 union {
19 ObjIface* _;
20 void* _is_Thread;
21 void* _is_ObjInst;
22 };
23 ObjClassInfo* _clsinfo;
24 atomic(uintptr) _ref;
25 atomic(ptr) _weakref;
26
27 threadFunc entry;
28 string name;
29 int exitCode; // only valid once 'running' become false
30 stvlist args;
31 sa_stvar _argsa; // should use the stvlist instead where possible
32 atomic(bool) running;
33 atomic(bool) requestExit;
34 Event notify;
35} Thread;
36extern ObjClassInfo Thread_clsinfo;
37#define Thread(inst) ((Thread*)(unused_noeval((inst) && &((inst)->_is_Thread)), (inst)))
38#define ThreadNone ((Thread*)NULL)
39
40typedef struct Thread_WeakRef {
41 union {
42 ObjInst* _inst;
43 void* _is_Thread_WeakRef;
44 void* _is_ObjInst_WeakRef;
45 };
46 atomic(uintptr) _ref;
47 RWLock _lock;
48} Thread_WeakRef;
49#define Thread_WeakRef(inst) ((Thread_WeakRef*)(unused_noeval((inst) && &((inst)->_is_Thread_WeakRef)), (inst)))
50
51_objfactory_guaranteed Thread* Thread_create(threadFunc func, _In_opt_ strref name, int n, stvar args[], bool ui);
52// Thread* _throbjCreate(threadFunc func, strref name, int n, stvar args[], bool ui);
53#define _throbjCreate(func, name, n, args, ui) Thread_create(func, name, n, args, ui)
54
55
Event synchronization primitive.
#define saDeclarePtr(name)
Definition sarray.h:98
#define _objfactory_guaranteed
Definition objimpl.h:104
#define stvar(typen, val)
Definition stvar.h:153
CX Object System - Object-oriented programming in C.
Dynamic arrays with type-safe generic programming.
Definition event.h:53
Variant type containers and type-safe variadic argument support.