Anjuta Developers Reference Manual: AnjutaAsyncCommand

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

## Functions

void | anjuta_async_command_set_error_message ()
gchar * | anjuta_async_command_get_error_message ()
void | anjuta_async_command_lock ()
void | anjuta_async_command_unlock ()

## Types and Values

| AnjutaAsyncCommandPriv

## Object Hierarchy

        GObject
        ╰── AnjutaCommand
            ╰── AnjutaAsyncCommand
                ╰── AnjutaPkgScanner

## Includes

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

## 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.

## Functions

### 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

#### Parameters

command | AnjutaAsyncCommand object |
error_message | The error message that should be used |

### anjuta_async_command_get_error_message ()

    gchar *
    anjuta_async_command_get_error_message
                                   (AnjutaCommand *command);

#### Parameters

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.

#### Parameters

self | AnjutaAsyncCommand object. |

### anjuta_async_command_unlock ()

    void
    anjuta_async_command_unlock (AnjutaAsyncCommand *self);

Unlocks the command's built-in mutex.

#### Parameters

self | AnjutaAsyncCommand object. |

## Types and Values

### AnjutaAsyncCommandPriv

    typedef struct _AnjutaAsyncCommandPriv AnjutaAsyncCommandPriv;