![]() |
async_select
2.0.2
async_select
|
Asynchronous network select implementation. More...
#include "async_select.h"
#include "async_select_configuration.h"
#include <string.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <unistd.h>
#include "LLNET_Common.h"
Go to the source code of this file.
Data Structures | |
struct | async_select_Request |
An asynchronous select request. More... | |
Macros | |
#define | async_select_get_current_time_ms() LLMJVM_IMPL_getCurrentTime__Z(1) |
Typedefs | |
typedef struct async_select_Request | async_select_Request |
An asynchronous select request. More... | |
Functions | |
void | async_select_lock (void) |
Enter critical section for the async_select component. | |
void | async_select_unlock (void) |
Exit critical section for the async_select component. | |
int64_t | LLMJVM_IMPL_getCurrentTime__Z (uint8_t system) |
External function used to retrieve currentTime (defined in LLMJVM) | |
void | async_select_request_fifo_init () |
Initializes the requests FIFOs. This function must be called prior to any call of async_select(). It can be called several times. | |
int32_t | non_blocking_select (int32_t fd, SELECT_Operation operation) |
Execute a select() for the given file descriptor and operation without blocking. More... | |
int32_t | async_select (int32_t fd, SELECT_Operation operation, int64_t timeout_ms, SNI_callback callback) |
Executes asynchronously a select() operation for the given file descriptor. More... | |
void | async_select_notify_closed_fd (int32_t fd) |
Notifies the async_select task that a file descriptor has been closed. On some systems the close of a file descriptor does not unblock the select that's why we need to notify the async_select task. | |
void | async_select_task_main () |
The entry point for the async_select task. This function must be called from a dedicated task. | |
Asynchronous network select implementation.
Definition in file async_select.c.
#define async_select_get_current_time_ms | ( | ) | LLMJVM_IMPL_getCurrentTime__Z(1) |
Gets the system time in milliseconds (int64_t). This time is independent from any user considerations and cannot be changed.
Definition at line 72 of file async_select.c.
typedef struct async_select_Request async_select_Request |
An asynchronous select request.
Sanity check between the expected version of the configuration and the actual version of the configuration. If an error is raised here, it means that a new version of the CCO has been installed and the configuration async_select_configuration.h must be updated based on the one provided by the new CCO version.
int32_t async_select | ( | int32_t | fd, |
SELECT_Operation | operation, | ||
int64_t | timeout_ms, | ||
SNI_callback | callback | ||
) |
Executes asynchronously a select() operation for the given file descriptor.
Executes asynchronously a select() operation for the given file descriptor. This function will suspend the execution of the current Java thread using SNI_suspendCurrentJavaThreadWithCallback(). Once the select() succeeds the Java thread is resumed and the given SNI callback is called.
This function will suspend the execution of the current Java thread using SNI_suspendCurrentJavaThreadWithCallback(). Once the select() succeeds the Java thread is resumed and the given SNI callback is called. *
fd | the file descriptor. |
operation | the operation (read or write) we want to monitor with the select(). |
timeout_ms | timeout in millisecond |
the | SNI callback to call when the Java thread is resumed or timeout occurs. |
Definition at line 174 of file async_select.c.
int32_t non_blocking_select | ( | int32_t | fd, |
SELECT_Operation | operation | ||
) |
Execute a select() for the given file descriptor and operation without blocking.
fd | the file descriptor. |
operation | the operation (read or write) we want to monitor with the select(). |
Definition at line 136 of file async_select.c.