IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
core
public
ice
os
unix.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/os/handle.hxx
>
6
7
#if ISP_UNIX
8
9
#include <sys/time.h>
10
#include <pthread.h>
11
#include <semaphore.h>
12
#include <unistd.h>
13
#include <dlfcn.h>
14
#include <stdlib.h>
15
#include <malloc.h>
16
#pragma clang diagnostic ignored "-Wunknown-attributes"
17
18
template
<>
19
struct
ice::os::HandleDescriptor
<
ice
::
os::HandleType::File
>
20
{
23
using
PlatformHandleType = int;
24
27
static
constexpr
PlatformHandleType InvalidHandle = -1;
28
29
static
bool
is_valid(PlatformHandleType handle,
void
*)
noexcept
30
{
31
return
handle != InvalidHandle;
32
}
33
34
static
bool
close(PlatformHandleType handle,
void
*)
noexcept
35
{
36
return ::close(handle) == 0;
37
}
38
};
39
40
template
<>
41
struct
ice::os::HandleDescriptor
<
ice
::
os::HandleType::DynLib
>
42
{
43
using
PlatformHandleType =
void
*;
44
45
static
constexpr
PlatformHandleType InvalidHandle =
nullptr
;
46
47
static
bool
is_valid(PlatformHandleType handle,
void
*)
noexcept
48
{
49
return
handle != InvalidHandle;
50
}
51
52
static
bool
close(PlatformHandleType handle,
void
*)
noexcept
53
{
54
return
dlclose(handle) == 0;
55
}
56
};
57
58
// Can't use 'unix' since it's a define
59
namespace
ice::unix_
60
{
61
62
using
FileHandle = ice::os::Handle<ice::os::HandleType::File>;
63
using
DynLibHandle = ice::os::Handle<ice::os::HandleType::DynLib>;
64
65
}
// namespace ice::unix
66
67
#endif
handle.hxx
ice::os::HandleType::File
@ File
Definition
handle.hxx:14
ice::os::HandleType::DynLib
@ DynLib
Definition
handle.hxx:15
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::os::HandleDescriptor
Definition
handle.hxx:26
Generated by
1.18.0