Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change the prototype of xbt_thread_create(), sorry.
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Oct 2009 11:54:23 +0000 (11:54 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Oct 2009 11:54:23 +0000 (11:54 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6782 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
examples/gras/synchro/philosopher.c
include/xbt/synchro_core.h
src/gras/Msg/gras_msg_listener.c
src/xbt/dynar.c
src/xbt/xbt_rl_synchro.c
src/xbt/xbt_synchro.c
teshsuite/xbt/parallel_log_crashtest.c

index 7579bfa..fc1e330 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -83,6 +83,9 @@ SimGrid (3.3.4) unstable; urgency=low
  XBT:
  * New function: xbt_dynar_dopar(dynar,fun) to map a function over the
    dynar with one separate thread per value of the dynar.
  XBT:
  * New function: xbt_dynar_dopar(dynar,fun) to map a function over the
    dynar with one separate thread per value of the dynar.
+ * Change the prototype of xbt_thread_create(), sorry. 
+   Added a boolean parameter indicating whether we want to join this
+   thread (used in SG only for now)
    
  Bug fixes:
  * GTNetS wrappers should now be usable again (and betterly tested too)
    
  Bug fixes:
  * GTNetS wrappers should now be usable again (and betterly tested too)
index 5289892..9bda397 100644 (file)
@@ -130,7 +130,7 @@ int philosopher(int argc, char *argv[])
   /* spawn threads */
   for (i = 0; i < philosopher_amount; i++) {
     char *name = bprintf("thread %d", i);
   /* spawn threads */
   for (i = 0; i < philosopher_amount; i++) {
     char *name = bprintf("thread %d", i);
-    philosophers[i] = xbt_thread_create(name, philo_thread, &id[i]);
+    philosophers[i] = xbt_thread_create(name, philo_thread, &id[i],0/*not joinable*/);
     free(name);
   }
 
     free(name);
   }
 
index 60e9362..ff5d294 100644 (file)
@@ -35,7 +35,7 @@ SG_BEGIN_DECL()
 
 XBT_PUBLIC(xbt_thread_t) xbt_thread_create(const char *name,
                                            void_f_pvoid_t start_routine,
 
 XBT_PUBLIC(xbt_thread_t) xbt_thread_create(const char *name,
                                            void_f_pvoid_t start_routine,
-                                           void *param);
+                                           void *param,int joinable);
 XBT_PUBLIC(void) xbt_thread_exit();
 XBT_PUBLIC(xbt_thread_t) xbt_thread_self(void);
 XBT_PUBLIC(const char *) xbt_thread_name(xbt_thread_t t);
 XBT_PUBLIC(void) xbt_thread_exit();
 XBT_PUBLIC(xbt_thread_t) xbt_thread_self(void);
 XBT_PUBLIC(const char *) xbt_thread_name(xbt_thread_t t);
index 3bf7c63..e4930fc 100644 (file)
@@ -97,7 +97,7 @@ gras_msg_listener_t gras_msg_listener_launch(xbt_queue_t msg_exchange)
   gras_msgtype_declare("_wakeup_listener", gras_datadesc_by_name("char"));
 
   /* actually start the thread */
   gras_msgtype_declare("_wakeup_listener", gras_datadesc_by_name("char"));
 
   /* actually start the thread */
-  arg->listener = xbt_thread_create("listener", listener_function, arg);
+  arg->listener = xbt_thread_create("listener", listener_function, arg,0/*not joinable*/);
   gras_os_sleep(0);             /* TODO: useless? give the listener a chance to initialize even if the main is empty and we cancel it right afterward */
   return arg;
 }
   gras_os_sleep(0);             /* TODO: useless? give the listener a chance to initialize even if the main is empty and we cancel it right afterward */
   return arg;
 }
index 0b59641..794af42 100644 (file)
@@ -1148,8 +1148,8 @@ XBT_TEST_UNIT("synchronized int", test_dynar_sync_int,"Synchronized dynars of in
 
   xbt_test_add0("==== Have a pusher and a popper on the dynar");
   d = xbt_dynar_new_sync(sizeof(int), NULL);
 
   xbt_test_add0("==== Have a pusher and a popper on the dynar");
   d = xbt_dynar_new_sync(sizeof(int), NULL);
-  pusher = xbt_thread_create("pusher", pusher_f, d);
-  poper = xbt_thread_create("poper", poper_f, d);
+  pusher = xbt_thread_create("pusher", pusher_f, d,0/*not joinable*/);
+  poper = xbt_thread_create("poper", poper_f, d,0/*not joinable*/);
   xbt_thread_join(pusher);
   xbt_thread_join(poper);
   xbt_dynar_free(&d);
   xbt_thread_join(pusher);
   xbt_thread_join(poper);
   xbt_dynar_free(&d);
index 519064c..e5ead86 100644 (file)
@@ -39,7 +39,7 @@ static void *xbt_thread_create_wrapper(void *p)
 
 
 xbt_thread_t xbt_thread_create(const char *name, void_f_pvoid_t code,
 
 
 xbt_thread_t xbt_thread_create(const char *name, void_f_pvoid_t code,
-                               void *param)
+                               void *param, int joinable)
 {
 
   xbt_thread_t res = xbt_new0(s_xbt_thread_t, 1);
 {
 
   xbt_thread_t res = xbt_new0(s_xbt_thread_t, 1);
index 7aa1cc0..59deea4 100644 (file)
@@ -39,7 +39,7 @@ void xbt_dynar_dopar(xbt_dynar_t datas, void_f_int_pvoid_t function) {
     w->function = function;
     w->rank=cursor;
     xbt_dynar_push(workers,&w);
     w->function = function;
     w->rank=cursor;
     xbt_dynar_push(workers,&w);
-    w->worker = xbt_thread_create("dopar worker",worker_wrapper,w);
+    w->worker = xbt_thread_create("dopar worker",worker_wrapper,w,1/*joinable*/);
   }
   /* wait them all */
   xbt_dynar_free(&workers);
   }
   /* wait them all */
   xbt_dynar_free(&workers);
index 3d55f8c..a910fbe 100644 (file)
@@ -71,7 +71,7 @@ int crasher(int argc, char *argv[])
   /* spawn threads */
   for (i = 0; i < crasher_amount; i++) {
     char *name = bprintf("thread %d", i);
   /* spawn threads */
   for (i = 0; i < crasher_amount; i++) {
     char *name = bprintf("thread %d", i);
-    crashers[i] = xbt_thread_create(name, &crasher_thread, &id[i]);
+    crashers[i] = xbt_thread_create(name, &crasher_thread, &id[i],0/*not joinable*/);
     free(name);
   }
 
     free(name);
   }