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
24 /*! \brief unit_new - create a new unit.
\r
26 * \param runner The runner which runs the unit.
\r
27 * \param owner The unit which owns the unit if it is an included unit.
\r
28 * \param fstream The file stream object used to parse the unit.
\r
30 * \return If successful the function returns the newly created
\r
31 * unit. Otherwise the function returns NULL and sets the
\r
32 * global variable errno with the appropiate error code.
\r
35 * [EINVAL] if one of the parameters is invalid.
\r
36 * [ENOMEM] if the system has not enough space to allocate
\r
40 unit_new(runner_t runner, unit_t root, unit_t owner, fstream_t fstream);
\r
42 /*! \brief unit_free - destroy a tesh unit.
\r
44 * \param ptr A pointer to the unit to destroy.
\r
46 * \return If successful the function returns 0. Otherwise the
\r
47 * function returns -1 and sets the global variable errno
\r
48 * with the appropiate error code.
\r
51 * [EINVAL] if the pointer to the unit to destroy is invalid.
\r
54 unit_free(unit_t* ptr);
\r
56 /*! \brief unit_run - run a tesh unit.
\r
58 * \param unit The unit to run.
\r
59 * \param mutex A mutex used to synchronize the access of the runner properties.
\r
61 * \return If successful the function returns 0. Otherwise the
\r
62 * function returns -1 and sets the global variable errno
\r
63 * with the appropiate error code.
\r
66 * [EINVAL] if the unit specified as parameter is invalid.
\r
67 * if the mutex specified as parameter is invalid.
\r
69 * remarks : If the runner is interrupted during a call of this function,
\r
70 * the unit is not launched but its flag interrupted is signaled.
\r
73 unit_run(unit_t unit, xbt_os_mutex_t mutex);
\r
76 /*! \brief unit_interrupt - interrupt a tesh unit.
\r
78 * \param unit The unit to interrupt.
\r
80 * \return If successful the function returns 0. Otherwise the
\r
81 * function returns -1 and sets the global variable errno
\r
82 * with the appropiate error code.
\r
85 * [EINVAL] if the unit specified as parameter is invalid.
\r
86 * [EALREADY] if the unit is already interrupted.
\r
88 * remarks : If the runner is interrupted during a call of this function,
\r
89 * the unit is not launched but its flag interrupted is signaled.
\r
92 unit_interrupt(unit_t unit);
\r
94 /*! \brief unit_summuarize - summarize the run of tesh unit.
\r
96 * \param unit The unit to summarize the run.
\r
98 * \return If successful the function returns 0. Otherwise the
\r
99 * function returns -1 and sets the global variable errno
\r
100 * with the appropiate error code.
\r
103 * [EINVAL] if the unit specified as parameter is invalid.
\r
106 unit_summuarize(unit_t unit);
\r
109 unit_reset(unit_t unit);
\r
112 unit_set_error(unit_t unit, int errcode, int kind, const char* line);
\r
119 #endif /* !__UNIT_H */
\r