Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[DOC] Fixed even more errors.
[simgrid.git] / src / simix / ThreadContext.hpp
index 4ecd959..d706a33 100644 (file)
@@ -21,8 +21,7 @@ class ThreadContextFactory;
 class ThreadContext : public Context {
 public:
   friend ThreadContextFactory;
-  ThreadContext(xbt_main_func_t code,
-          int argc, char **argv,
+  ThreadContext(std::function<void()> code,
           void_pfn_smxprocess_t cleanup_func,
           smx_process_t process);
   ~ThreadContext();
@@ -30,11 +29,11 @@ public:
   void suspend() override;
 private:
   /** A portable thread */
-  xbt_os_thread_t thread_;
+  xbt_os_thread_t thread_ = nullptr;
   /** Semaphore used to schedule/yield the process */
-  xbt_os_sem_t begin_;
+  xbt_os_sem_t begin_ = nullptr;
   /** Semaphore used to schedule/unschedule */
-  xbt_os_sem_t end_;
+  xbt_os_sem_t end_ = nullptr;
 private:
   static void* wrapper(void *param);
 };
@@ -43,10 +42,8 @@ class ThreadContextFactory : public ContextFactory {
 public:
   ThreadContextFactory();
   ~ThreadContextFactory();
-  virtual ThreadContext* create_context(
-    xbt_main_func_t, int, char **, void_pfn_smxprocess_t,
-    smx_process_t process
-    ) override;
+  virtual ThreadContext* create_context(std::function<void()> code,
+    void_pfn_smxprocess_t cleanup_func,  smx_process_t process) override;
   void run_all() override;
   ThreadContext* self() override;
 };