acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_pthread.h
1//
2// Created by camilo on 13/02/2021. <3TBS_!!
3//
4#pragma once
5
6
7#ifdef PARALLELIZATION_PTHREAD
8
9
10//xxx #undef scoped_restore
11
12
13#include <pthread.h>
14
15
16inline void pthread_recursive_mutex_init(pthread_mutex_t * pmutex)
17{
18
19 ::pthread_mutexattr_t attr;
20
21 ::pthread_mutexattr_init(&attr);
22
23 ::pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
24
25 ::pthread_mutex_init(pmutex, &attr);
26
27 ::pthread_mutexattr_destroy(&attr);
28
29}
30
31
32
33//class synchronization;
34
35
36
37#define PM_NOREMOVE 0
38#define PM_REMOVE 1
39
40
41//#define WAIT_TIMEOUT 258L // dderror
42//#define WAIT_FAILED ((::u32 ) 0xFFFFFFFFL)
43//#define WAIT_OBJECT_0 ((::u32 ) STATUS_WAIT_0 + 0)
44//
45//#define WAIT_ABANDONED ((::u32 ) STATUS_ABANDONED_WAIT_0 + 0)
46//#define WAIT_ABANDONED_0 ((::u32 ) STATUS_ABANDONED_WAIT_0 + 0)
47//
48//#define WAIT_IO_COMPLETION STATUS_USER_APC
49
50
51// based on Windows implementation and also a good limit for iterations with nanosleep and multiple locks in objects up to MAXIMUM_WAIT_OBJECTS in a single call
52#define MAXIMUM_WAIT_OBJECTS 64
53
54
55#include "semun.h"
56
57
58//#include "acme/operating_system/cross/windows/parallelization2.h"
59
60//#include <sched.h>
61
62void get_os_priority(::i32 * piPolicy, sched_param * pparam, ::enum_priority epriority);
63
64
65#endif
66
67
68