Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
versatile implementation do not fake the xbt_thread type anymore but has its own...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 11 Jul 2007 16:05:33 +0000 (16:05 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 11 Jul 2007 16:05:33 +0000 (16:05 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3736 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/xbt/xbt_os_thread.h
src/xbt/xbt_os_thread.c

index a2a1de7..fc37c29 100644 (file)
@@ -34,6 +34,7 @@ SG_BEGIN_DECL()
   /* xbt_os_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
   XBT_PUBLIC(void) xbt_os_thread_join(xbt_os_thread_t thread,void ** thread_return);
   XBT_PUBLIC(void) xbt_os_thread_yield(void);
   /* xbt_os_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
   XBT_PUBLIC(void) xbt_os_thread_join(xbt_os_thread_t thread,void ** thread_return);
   XBT_PUBLIC(void) xbt_os_thread_yield(void);
+  XBT_PUBLIC(void*) xbt_os_thread_getparam(void);
 
 
   /** \brief Thread mutex data type (opaque structure) */
 
 
   /** \brief Thread mutex data type (opaque structure) */
index 81c86e9..b023fe8 100644 (file)
@@ -24,7 +24,6 @@
 #include <pthread.h>
 
 typedef struct xbt_os_thread_ {
 #include <pthread.h>
 
 typedef struct xbt_os_thread_ {
-  /* KEEP IT IN SYNC WITH xbt_thread.c */
    pthread_t t;
    void *param;
    pvoid_f_pvoid_t *start_routine;
    pthread_t t;
    void *param;
    pvoid_f_pvoid_t *start_routine;
@@ -208,12 +207,16 @@ void xbt_os_cond_destroy(xbt_os_cond_t cond){
    free(cond);
 }
 
    free(cond);
 }
 
+void *xbt_os_thread_getparam(void) {
+   xbt_os_thread_t t = xbt_os_thread_self();
+   return t->param;
+}
+
 /* ********************************* WINDOWS IMPLEMENTATION ************************************ */
 
 #elif defined(WIN32)
 
 typedef struct xbt_os_thread_ {
 /* ********************************* WINDOWS IMPLEMENTATION ************************************ */
 
 #elif defined(WIN32)
 
 typedef struct xbt_os_thread_ {
-  /* KEEP IT IN SYNC WITH xbt_thread */
   HANDLE handle;                  /* the win thread handle        */
   unsigned long id;               /* the win thread id            */
   pvoid_f_pvoid_t *start_routine;
   HANDLE handle;                  /* the win thread handle        */
   unsigned long id;               /* the win thread id            */
   pvoid_f_pvoid_t *start_routine;
@@ -289,6 +292,12 @@ xbt_os_thread_t xbt_os_thread_self(void) {
    return TlsGetValue(xbt_self_thread_key);
 }
 
    return TlsGetValue(xbt_self_thread_key);
 }
 
+void *xbt_os_thread_getparam(void) {
+   xbt_os_thread_t t = xbt_os_thread_self();
+   return t->param;
+}
+
+
 void xbt_os_thread_yield(void) {
     Sleep(0);
 }
 void xbt_os_thread_yield(void) {
     Sleep(0);
 }