+
+ if(_surf_parallel_contexts){
+#ifdef CONTEXT_THREADS /* To use parallel ucontexts a thread pool is needed */
+ tpool = xbt_tpool_new(2, 10);
+ (*factory)->runall = smx_ctx_sysv_runall_parallel;
+ (*factory)->self = smx_ctx_sysv_self_parallel;
+#else
+ THROW0(arg_error, 0, "No thread support for parallel context execution");
+#endif
+ }else{
+ (*factory)->runall = smx_ctx_sysv_runall;
+ }
+}
+
+int smx_ctx_sysv_factory_finalize(smx_context_factory_t *factory)
+{
+ if(tpool)
+ xbt_tpool_destroy(tpool);
+ return smx_ctx_base_factory_finalize(factory);