![]() |
![]() |
![]() |
Camel Reference Manual | ![]() |
---|---|---|---|---|
CamelOperation; void (*CamelOperationStatusFunc) (struct _CamelOperation *op, const char *what, int pc, void *data); enum camel_operation_status_t; CamelOperation* camel_operation_new (CamelOperationStatusFunc status, void *status_data); void camel_operation_mute (CamelOperation *cc); void camel_operation_ref (CamelOperation *cc); void camel_operation_unref (CamelOperation *cc); void camel_operation_cancel (CamelOperation *cc); void camel_operation_uncancel (CamelOperation *cc); CamelOperation* camel_operation_register (CamelOperation *cc); void camel_operation_unregister (CamelOperation *cc); void camel_operation_cancel_block (CamelOperation *cc); void camel_operation_cancel_unblock (CamelOperation *cc); int camel_operation_cancel_check (CamelOperation *cc); int camel_operation_cancel_fd (CamelOperation *cc); struct PRFileDesc* camel_operation_cancel_prfd (CamelOperation *cc); CamelOperation* camel_operation_registered (void); void camel_operation_start (CamelOperation *cc, char *what, ...); void camel_operation_start_transient (CamelOperation *cc, char *what, ...); void camel_operation_progress (CamelOperation *cc, int pc); void camel_operation_progress_count (CamelOperation *cc, int sofar); void camel_operation_end (CamelOperation *cc);
void (*CamelOperationStatusFunc) (struct _CamelOperation *op, const char *what, int pc, void *data);
|
|
|
|
|
|
|
typedef enum _camel_operation_status_t { CAMEL_OPERATION_START = -1, CAMEL_OPERATION_END = -2 } camel_operation_status_t;
CamelOperation* camel_operation_new (CamelOperationStatusFunc status, void *status_data);
Create a new camel operation handle. Camel operation handles can be used in a multithreaded application (or a single operation handle can be used in a non threaded appliation) to cancel running operations and to obtain notification messages of the internal status of messages.
|
Callback for receiving status messages. This will always be called with an internal lock held. |
|
User data. |
Returns : |
A new operation handle. |
void camel_operation_mute (CamelOperation *cc);
mutes a camel operation permanently. from this point on you will never receive operation updates, even if more are sent.
|
void camel_operation_ref (CamelOperation *cc);
Add a reference to the CamelOperation cc
.
|
operation context |
void camel_operation_unref (CamelOperation *cc);
Unref and potentially free cc
.
|
operation context |
void camel_operation_cancel (CamelOperation *cc);
Cancel a given operation. If cc
is NULL then all outstanding
operations are cancelled.
|
operation context |
void camel_operation_uncancel (CamelOperation *cc);
Uncancel a cancelled operation. If cc
is NULL then the current
operation is uncancelled.
This is useful, if e.g. you need to do some cleaning up where a cancellation lying around in the same thread will abort any processing.
|
operation context |
CamelOperation* camel_operation_register (CamelOperation *cc);
Register a thread or the main thread for cancellation through cc
.
If cc
is NULL, then a new cancellation is created for this thread.
All calls to operation_register()
should save their value and call
operation_register again with that, to automatically stack
registrations.
|
operation context |
Returns : |
Returns the previously registered operatoin. |
void camel_operation_unregister (CamelOperation *cc);
Unregister the current thread for all cancellations.
|
operation context |
void camel_operation_cancel_block (CamelOperation *cc);
Block cancellation for this operation. If cc
is NULL, then the
current thread is blocked.
|
operation context |
void camel_operation_cancel_unblock (CamelOperation *cc);
Unblock cancellation, when the unblock count reaches the block
count, then this operation can be cancelled. If cc
is NULL, then
the current thread is unblocked.
|
operation context |
int camel_operation_cancel_check (CamelOperation *cc);
Check if cancellation has been applied to cc
. If cc
is NULL,
then the CamelOperation registered for the current thread is used.
|
operation context |
Returns : |
TRUE if the operation has been cancelled. |
int camel_operation_cancel_fd (CamelOperation *cc);
Retrieve a file descriptor that can be waited on (select, or poll) for read, to asynchronously detect cancellation.
|
operation context |
Returns : |
The fd, or -1 if cancellation is not available (blocked, or has not been registered for this thread). |
struct PRFileDesc* camel_operation_cancel_prfd (CamelOperation *cc);
Retrieve a file descriptor that can be waited on (select, or poll) for read, to asynchronously detect cancellation.
|
operation context |
Returns : |
The fd, or NULL if cancellation is not available (blocked, or has not been registered for this thread). |
CamelOperation* camel_operation_registered (void);
Returns : |
the registered operation, or NULL if none registered.
|
void camel_operation_start (CamelOperation *cc, char *what, ...);
Report the start of an operation. All start operations should have similar end operations.
|
operation context |
|
action being performed (printf-style format string) |
|
varargs |
void camel_operation_start_transient (CamelOperation *cc, char *what, ...);
Start a transient event. We only update this to the display if it takes very long to process, and if we do, we then go back to the previous state when finished.
|
operation context |
|
printf-style format string describing the action being performed |
|
varargs |
void camel_operation_progress (CamelOperation *cc, int pc);
Report progress on the current operation. If cc
is NULL, then the
currently registered operation is used. pc
reports the current
percentage of completion, which should be in the range of 0 to 100.
If the total percentage is not know, then use
camel_operation_progress_count()
.
|
Operation to report to. |
|
Percent complete, 0 to 100. |
void camel_operation_progress_count (CamelOperation *cc, int sofar);
|
operation context |
|
void camel_operation_end (CamelOperation *cc);
Report the end of an operation. If cc
is NULL, then the currently
registered operation is notified.
|
operation context |