base: Tag API methods in coroutine.hh
Change-Id: Ifd0aade13b0979d8f8433577be7f019d83406e6a Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32963 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
@@ -93,6 +93,8 @@ class Coroutine : public Fiber
|
||||
*
|
||||
* This method is generated only if the coroutine returns
|
||||
* a value (Ret != void)
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
template <typename T = Ret>
|
||||
CallerType&
|
||||
@@ -109,6 +111,8 @@ class Coroutine : public Fiber
|
||||
*
|
||||
* This method is generated only if the coroutine doesn't
|
||||
* return a value (Ret = void)
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
template <typename T = Ret>
|
||||
typename std::enable_if<std::is_same<T, void>::value,
|
||||
@@ -128,6 +132,8 @@ class Coroutine : public Fiber
|
||||
* from the caller.
|
||||
*
|
||||
* @return arg coroutine argument
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
template <typename T = Arg>
|
||||
typename std::enable_if<!std::is_same<T, void>::value, T>::type
|
||||
@@ -149,9 +155,14 @@ class Coroutine : public Fiber
|
||||
RetChannel retChannel;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup api_coroutine
|
||||
* @{
|
||||
*/
|
||||
Coroutine() = delete;
|
||||
Coroutine(const Coroutine& rhs) = delete;
|
||||
Coroutine& operator=(const Coroutine& rhs) = delete;
|
||||
/** @} */ // end of api_coroutine
|
||||
|
||||
/**
|
||||
* Coroutine constructor.
|
||||
@@ -167,6 +178,8 @@ class Coroutine : public Fiber
|
||||
* @param f task run by the coroutine
|
||||
* @param run_coroutine set to false to disable running the coroutine
|
||||
* immediately after it is created
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
Coroutine(std::function<void(CallerType&)> f, bool run_coroutine = true)
|
||||
: Fiber(), task(f), caller(*this)
|
||||
@@ -176,6 +189,9 @@ class Coroutine : public Fiber
|
||||
this->call();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
virtual ~Coroutine() {}
|
||||
|
||||
public:
|
||||
@@ -187,6 +203,8 @@ class Coroutine : public Fiber
|
||||
*
|
||||
* This method is generated only if the coroutine takes
|
||||
* arguments (Arg != void)
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
template <typename T = Arg>
|
||||
Coroutine&
|
||||
@@ -203,6 +221,8 @@ class Coroutine : public Fiber
|
||||
*
|
||||
* This method is generated only if the coroutine takes
|
||||
* no arguments. (Arg = void)
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
template <typename T = Arg>
|
||||
typename std::enable_if<std::is_same<T, void>::value, Coroutine>::type&
|
||||
@@ -221,6 +241,8 @@ class Coroutine : public Fiber
|
||||
* from the coroutine.
|
||||
*
|
||||
* @return ret yielded value
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
template <typename T = Ret>
|
||||
typename std::enable_if<!std::is_same<T, void>::value, T>::type
|
||||
@@ -236,7 +258,11 @@ class Coroutine : public Fiber
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Check if coroutine is still running */
|
||||
/**
|
||||
* Check if coroutine is still running
|
||||
*
|
||||
* @ingroup api_coroutine
|
||||
*/
|
||||
operator bool() const { return !this->finished(); }
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user