diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2011-10-03 16:12:51 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2011-10-24 13:33:20 -0500 |
commit | 4962a22309cd7e3586aa57817689b18d67ca71c7 (patch) | |
tree | 2bfd610d6ed048f7d4a35717211eca06b15d1f69 /src/include/util/locked/list.H | |
parent | 21185b30cd99a00f01e15edba28402cdc00de1d1 (diff) | |
download | talos-hostboot-4962a22309cd7e3586aa57817689b18d67ca71c7.tar.gz talos-hostboot-4962a22309cd7e3586aa57817689b18d67ca71c7.zip |
Support task_wait / task_wait_tid syscalls:
- Add task_end2 syscall to allow pthread_exit-like retval.
- Add/maintain task states.
- Create task parent/child tracking tree.
- Add task_detach function.
- Implement wait syscalls.
Make task_exec caller the parent of spawned task:
Previously the task_exec call caused a message to the
VFS task, which called task_create and returned the tid
in response to the message. This causes the parent of
the spawned task to appear to be the VFS task.
Modify task_exec / VFS handling to instead return the
entry point address on the message and have task_exec call
task_create directly itself.
Change-Id: I6b6796f45875de37b1ab01e7596639b073820b95
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/443
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'src/include/util/locked/list.H')
-rw-r--r-- | src/include/util/locked/list.H | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/include/util/locked/list.H b/src/include/util/locked/list.H index 5e06c5e8e..dc19ff193 100644 --- a/src/include/util/locked/list.H +++ b/src/include/util/locked/list.H @@ -46,6 +46,9 @@ namespace Util _T* find(_K& key) const; + bool empty(); + _T* begin(); + protected: _T* head; _T* tail; @@ -56,6 +59,31 @@ namespace Util void __unlock() const; }; + // SFINAE template to ensure compile fails if functions which are not + // SMP-safe are used on a 'locked' instance. + template<bool locked> + class __verify_list_is_smp_safe + { + public: + __verify_list_is_smp_safe() + { + class __util_locked_list_is_not_smp_safe; + __util_locked_list_is_not_smp_safe(); + } + }; + + // SFINAE template implementation to allow certain functions when the + // instance is not 'locked', assuming that caller is ensuring safety + // in some other way. + template<> + class __verify_list_is_smp_safe<false> + { + public: + __verify_list_is_smp_safe() + { + } + }; + template <typename _T, typename _K, bool locked, typename _S> _T* List<_T,_K,locked,_S>::remove() { @@ -169,6 +197,31 @@ namespace Util return node; } + + template <typename _T, typename _K, bool locked, typename _S> + bool List<_T, _K,locked,_S>::empty() + { + bool isEmpty = false; + + __lock(); + isEmpty = (head == NULL); + __unlock(); + + return isEmpty; + } + + template <typename _T, typename _K, bool locked, typename _S> + _T* List<_T, _K,locked,_S>::begin() + { + // Entirely not SMP-safe to return a pointer to a node if + // we are a locking instance. If we aren't locking we + // have to assume that the caller is ensuring SMP-safety + // globally in some other way. Use SFINAE technique to + // ensure begin() fails on locked lists. + __verify_list_is_smp_safe<locked>(); + return head; + } + } } |