41 lines
962 B
C
41 lines
962 B
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "error/error.h"
|
|
#include "thread/thread.h"
|
|
|
|
typedef struct {
|
|
thread_t thread;
|
|
} networkhttp_t;
|
|
|
|
extern networkhttp_t NETWORK_HTTP;
|
|
|
|
/**
|
|
* Initializes the HTTP client: prepares the request pool and starts
|
|
* the background worker thread. Called once during engine startup.
|
|
*
|
|
* @return Any error that occurs.
|
|
*/
|
|
errorret_t networkHttpInit(void);
|
|
|
|
/**
|
|
* Dispatches any requests that finished on the background thread since
|
|
* the last call: fires onComplete/onError on the main thread, frees
|
|
* the response, and returns the slot to the pool. Call once per frame.
|
|
*
|
|
* @return Any error that occurs.
|
|
*/
|
|
errorret_t networkHttpUpdate(void);
|
|
|
|
/**
|
|
* Stops the background worker thread and disposes of the HTTP client.
|
|
*
|
|
* @return Any error that occurs.
|
|
*/
|
|
errorret_t networkHttpDispose(void);
|