|
| Request (int priority, int type) |
| Creates a request that can be handled by the RequestManager.
|
|
void | execute () |
| Executes the request.
|
|
void | executeNow () |
| Executes the request now, i.e.
|
|
void | queue () |
| Inserts this request into the RequestManager's queue for executing.
|
|
virtual void | callback () |
| Executed when a request has finished.
|
|
int | getType () const |
| Returns the type of the request.
|
|
int | getPriority () const |
| Returns the priority of this request.
|
|
void | cancel () |
| Signals that this request should be canceled.
|
|
bool | isCancelled () const |
| Returns if this request is to be canceled.
|
|
bool | isAbortable () const |
| Returns if this request can be aborted.
|
|
void | setAbortable (bool b) |
| Sets if this request is abortable or not.
|
|
void | setBusy () |
| Sets the request state to busy.
|
|
void | setExecuted () |
| Sets the request to be completed.
|
|
void | setDone () |
| Should only be called by the manager.
|
|
bool | isDone () const |
| Returns if this request is done.
|
|
bool | isPreparing () const |
| Returns if this request is being prepared.
|
|
bool | isBusy () const |
| Returns if this request is busy.
|
|
bool | hasBeenExecuted () const |
| Checks if the request has completed or done (i.e.
|
|
virtual bool | isAllowedToAdd () const |
| Virtual method to check if a request has initialized all needed members to a valid value.
|
|
Stores a request for the HTTP Manager.
They will be sorted by prioritiy. Requests have four different states they can be in, and this state determines which thread can access it. This allows the use of threading without adding more synchronisation overhead and code to the main thread. The states are:
- Preparing
The request is created, and parameter are set. Only the main thread can access this object.
- Busy
The request is put into the request_manager queue. It remains in this states till its operation is finished. No more changes to this object by the main thread are allowed, only the manager thread can change it now.
- Executed
The request was executed (its operation called and finished), but callbacks still need to be done by the manager thread (main reason for this state is to have asserts in function accessing data).
- Done
All callbacks are done (they will be executed by the main thread), the request was moved from the manager's request queue to its finished queue, executed its callbacks and was removed from the queue. The manager thread will not access this object anymore, and the main thread is now able to access the request object again.