2 * include/unit.h - type representing the tesh unit concept.
\r
4 * Copyright 2008,2009 Martin Quinson, Malek Cherier All right reserved.
\r
6 * This program is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the license (GNU LGPL) which comes with this package.
\r
10 * This file contains all the declarations of the functions related with
\r
11 * the tesh unit concept.
\r
25 /*! \brief unit_new - create a new unit.
\r
27 * \param runner The runner which runs the unit.
\r
28 * \param owner The unit which owns the unit if it is an included unit.
\r
29 * \param fstream The file stream object used to parse the unit.
\r
31 * \return If successful the function returns the newly created
\r
32 * unit. Otherwise the function returns NULL and sets the
\r
33 * global variable errno with the appropiate error code.
\r
36 * [EINVAL] if one of the parameters is invalid.
\r
37 * [ENOMEM] if the system has not enough space to allocate
\r
41 unit_new(runner_t runner, unit_t root, unit_t owner,
44 /*! \brief unit_free - destroy a tesh unit.
\r
46 * \param ptr A pointer to the unit to destroy.
\r
48 * \return If successful the function returns 0. Otherwise the
\r
49 * function returns -1 and sets the global variable errno
\r
50 * with the appropiate error code.
\r
53 * [EINVAL] if the pointer to the unit to destroy is invalid.
\r
55 int
\r unit_free(unit_t * ptr);
57 /*! \brief unit_run - run a tesh unit.
\r
59 * \param unit The unit to run.
\r
60 * \param mutex A mutex used to synchronize the access of the runner properties.
\r
62 * \return If successful the function returns 0. Otherwise the
\r
63 * function returns -1 and sets the global variable errno
\r
64 * with the appropiate error code.
\r
67 * [EINVAL] if the unit specified as parameter is invalid.
\r
68 * if the mutex specified as parameter is invalid.
\r
70 * remarks : If the runner is interrupted during a call of this function,
\r
71 * the unit is not launched but its flag interrupted is signaled.
\r
73 int
\r unit_run(unit_t unit, xbt_os_mutex_t mutex);
75 /*! \brief unit_interrupt - interrupt a tesh unit.
\r
77 * \param unit The unit to interrupt.
\r
79 * \return If successful the function returns 0. Otherwise the
\r
80 * function returns -1 and sets the global variable errno
\r
81 * with the appropiate error code.
\r
84 * [EINVAL] if the unit specified as parameter is invalid.
\r
85 * [EALREADY] if the unit is already interrupted.
\r
87 * remarks : If the runner is interrupted during a call of this function,
\r
88 * the unit is not launched but its flag interrupted is signaled.
\r
90 int
\r unit_interrupt(unit_t unit);
92 /*! \brief unit_summuarize - summarize the run of tesh unit.
\r
94 * \param unit The unit to summarize the run.
\r
96 * \return If successful the function returns 0. Otherwise the
\r
97 * function returns -1 and sets the global variable errno
\r
98 * with the appropiate error code.
\r
101 * [EINVAL] if the unit specified as parameter is invalid.
\r
103 int
\r unit_summuarize(unit_t unit);
104 \r \r int
\r unit_reset(unit_t unit);
106 unit_set_error(unit_t unit, int errcode, int kind, const char *line);
112 #endif /* !__UNIT_H */
\r