AnjutaAsyncCommand

AnjutaAsyncCommand — AnjutaCommand subclass that serves as the base for commands that need to run in another thread.

Synopsis

#include <libanjuta/anjuta-async-command.h>

struct              AnjutaAsyncCommandClass;
                    AnjutaAsyncCommandPriv;
gchar *             anjuta_async_command_get_error_message
                                                        (AnjutaCommand *command);
void                anjuta_async_command_lock           (AnjutaAsyncCommand *self);
void                anjuta_async_command_set_error_message
                                                        (AnjutaCommand *command,
                                                         const gchar *error_message);
void                anjuta_async_command_unlock         (AnjutaAsyncCommand *self);

Description

AnjutaAsyncCommand provides a simple way for plugins to run tasks that are synchronous and usually take several seconds or longer to execute in another thread so that such tasks do no block Anjuta's user interface.

AnjutaAsyncCommand automatically runs and manages the thread when the command starts, and destroys it when the command finishes. Aside from locking protected data with anjuta_async_command_lock/unlock, clients, and even commands themselves need not even be concerned that their tasks are rnning on another thread.

For an example of how AnjutaAsyncCommand is used, see the Subversion plugin.

Details

struct AnjutaAsyncCommandClass

struct AnjutaAsyncCommandClass {
	AnjutaCommandClass parent_class;
};


AnjutaAsyncCommandPriv

typedef struct _AnjutaAsyncCommandPriv AnjutaAsyncCommandPriv;


anjuta_async_command_get_error_message ()

gchar *             anjuta_async_command_get_error_message
                                                        (AnjutaCommand *command);

command :

AnjutaAsyncCommand object

Returns :

The error message the async command resulted in. The caller should free the string

anjuta_async_command_lock ()

void                anjuta_async_command_lock           (AnjutaAsyncCommand *self);

Locks the command's built-in mutex.

self :

AnjutaAsyncCommand object.

anjuta_async_command_set_error_message ()

void                anjuta_async_command_set_error_message
                                                        (AnjutaCommand *command,
                                                         const gchar *error_message);

Set the error message this async command resulted in

command :

AnjutaAsyncCommand object

error_message :

The error message that should be used

anjuta_async_command_unlock ()

void                anjuta_async_command_unlock         (AnjutaAsyncCommand *self);

Unlocks the command's built-in mutex.

self :

AnjutaAsyncCommand object.