A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a TESH for the new sthread feature
[simgrid.git]
/
examples
/
sthread
/
pthread-mutex-simple.c
diff --git
a/examples/sthread/pthread-mutex-simple.c
b/examples/sthread/pthread-mutex-simple.c
index
abe582d
..
b59214f
100644
(file)
--- a/
examples/sthread/pthread-mutex-simple.c
+++ b/
examples/sthread/pthread-mutex-simple.c
@@
-10,6
+10,7
@@
static void* thread1_fun(void* ignore)
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
+ fprintf(stderr, "The first thread is terminating.\n");
return NULL;
}
static void* thread2_fun(void* ignore)
return NULL;
}
static void* thread2_fun(void* ignore)
@@
-17,23
+18,21
@@
static void* thread2_fun(void* ignore)
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
+ fprintf(stderr, "The second thread is terminating.\n");
return NULL;
}
int main(int argc, char* argv[])
{
return NULL;
}
int main(int argc, char* argv[])
{
- fprintf(stderr, "User main is starting\n");
-
pthread_mutex_init(&mutex, NULL);
pthread_t thread1, thread2;
pthread_create(&thread1, NULL, thread1_fun, NULL);
pthread_mutex_init(&mutex, NULL);
pthread_t thread1, thread2;
pthread_create(&thread1, NULL, thread1_fun, NULL);
- fprintf(stderr, "here\n");
pthread_create(&thread2, NULL, thread2_fun, NULL);
pthread_create(&thread2, NULL, thread2_fun, NULL);
- fprintf(stderr, "
there
\n");
+ fprintf(stderr, "
All threads are started.
\n");
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
- fprintf(stderr, "User
main is done
\n");
+ fprintf(stderr, "User
's main is terminating.
\n");
return 0;
}
return 0;
}