Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Florian Fischer
emper
Commits
6614962b
Commit
6614962b
authored
Oct 06, 2020
by
Florian Fischer
Browse files
fixup! export async functions to C
parent
75bef808
Changes
2
Hide whitespace changes
Inline
Side-by-side
emper/c_emper.cpp
View file @
6614962b
#include
"emper.h"
#include
"emper-config.h"
#include
"Runtime.hpp"
#include
"Fiber.hpp"
#include
"BinaryPrivateSemaphore.hpp"
...
...
@@ -101,38 +102,38 @@ void wait_cps(cps* sem) {
}
#ifdef EMPER_ASYNC_NETWORK
int
async_recv
(
int
fd
,
unsigned
char
*
buff
,
int
buff_len
,
int
flags
)
{
bool
read_once
=
flags
&
READ_FULL_BUFFER
==
0
;
bool
fd_serialized
=
flags
&
UNSERIALIZED
==
0
;
int
async_recv
(
int
fd
,
void
*
buff
,
int
buff_len
,
int
flags
)
{
bool
read_once
=
(
flags
&
READ_FULL_BUFFER
)
==
0
;
bool
fd_serialized
=
(
flags
&
UNSERIALIZED
)
==
0
;
return
io
::
async_recv
(
fd
,
buff
,
buff_len
,
read_once
,
fd_serialized
);
return
io
::
async_recv
(
fd
,
(
unsigned
char
*
)
buff
,
buff_len
,
read_once
,
fd_serialized
);
}
int
async_send
(
int
fd
,
unsigned
char
*
buff
,
int
buff_len
,
int
flags
)
{
bool
fd_serialized
=
flags
&
UNSERIALIZED
==
0
;
int
async_send
(
int
fd
,
const
void
*
buff
,
int
buff_len
,
int
flags
)
{
bool
fd_serialized
=
(
flags
&
UNSERIALIZED
)
==
0
;
return
io
::
async_
recv
(
fd
,
buff
,
buff_len
,
read_once
,
fd_serialized
);
return
io
::
async_
send
(
fd
,
(
unsigned
char
*
)
buff
,
buff_len
,
fd_serialized
);
}
int
async_connect
(
int
fd
,
sockaddr
*
sockaddress
,
s
ocklen
_t
len
,
int
flags
)
{
bool
fd_serialized
=
flags
&
UNSERIALIZED
==
0
;
int
async_connect
(
int
fd
,
struct
sockaddr
*
sockaddress
,
s
ize
_t
len
,
int
flags
)
{
bool
fd_serialized
=
(
flags
&
UNSERIALIZED
)
==
0
;
return
io
::
async_connect
(
fd
,
sockaddress
,
len
,
fd_serialized
);
}
int
async_accept
(
int
fd
,
sockaddr
*
sockaddress
,
s
ocklen
_t
len
,
int
flags
)
{
bool
fd_serialized
=
flags
&
UNSERIALIZED
==
0
;
int
async_accept
(
int
fd
,
struct
sockaddr
*
sockaddress
,
s
ize
_t
len
,
int
flags
)
{
bool
fd_serialized
=
(
flags
&
UNSERIALIZED
)
==
0
;
return
io
::
async_accept
(
fd
,
sockaddress
,
len
,
fd_serialized
);
}
#endif
#ifdef EMPER_ASYNC_DISK_IO
int
async_read_file
(
int
fd
,
unsigned
char
*
buff
,
size_t
count
,
off_t
offset
)
{
int
async_read_file
(
int
fd
,
void
*
buff
,
size_t
count
,
off_t
offset
)
{
return
io
::
async_read_file
(
fd
,
buff
,
count
,
offset
);
}
int
async_write_file
(
int
fd
,
const
unsigned
char
*
buff
,
size_t
count
,
off_t
offset
)
{
int
async_write_file
(
int
fd
,
const
void
*
buff
,
size_t
count
,
off_t
offset
)
{
return
io
::
async_write_file
(
fd
,
buff
,
count
,
offset
);
}
#endif
emper/include/emper.h
View file @
6614962b
#pragma once
#include
"emper-common.h"
#include
"emper-config.h"
#include
"stddef.h"
#ifdef EMPER_ASYNC_NETWORK
#include
"sys/socket.h"
...
...
@@ -66,19 +68,19 @@ extern "C" {
UNSERIALIZED
=
2
,
};
int
async_recv
(
int
fd
,
unsigned
char
*
buff
,
int
buff_len
,
int
flags
);
int
async_recv
(
int
fd
,
void
*
buff
,
int
buff_len
,
int
flags
);
int
async_send
(
int
fd
,
unsigned
char
*
buff
,
int
buff_len
,
int
flags
);
int
async_send
(
int
fd
,
const
void
*
buff
,
int
buff_len
,
int
flags
);
int
async_connect
(
int
fd
,
sockaddr
*
sockaddress
,
s
ocklen
_t
len
,
int
flags
);
int
async_connect
(
int
fd
,
struct
sockaddr
*
sockaddress
,
s
ize
_t
len
,
int
flags
);
int
async_accept
(
int
fd
,
sockaddr
*
sockaddress
,
s
ocklen
_t
len
,
int
flags
);
int
async_accept
(
int
fd
,
struct
sockaddr
*
sockaddress
,
s
ize
_t
len
,
int
flags
);
#endif
#ifdef EMPER_ASYNC_DISK_IO
int
async_read_file
(
int
fd
,
unsigned
char
*
buff
,
size_t
count
,
off_t
offset
);
int
async_read_file
(
int
fd
,
void
*
buff
,
size_t
count
,
off_t
offset
);
int
async_write_file
(
int
fd
,
const
unsigned
char
*
buff
,
size_t
count
,
off_t
offset
);
int
async_write_file
(
int
fd
,
const
void
*
buff
,
size_t
count
,
off_t
offset
);
#endif
#ifdef __cplusplus
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment