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
On windows pthread_atfork is not implemented
[simgrid.git]
/
src
/
xbt
/
xbt_os_thread.c
diff --git
a/src/xbt/xbt_os_thread.c
b/src/xbt/xbt_os_thread.c
index
b020ebd
..
3cb6dbb
100644
(file)
--- a/
src/xbt/xbt_os_thread.c
+++ b/
src/xbt/xbt_os_thread.c
@@
-137,7
+137,11
@@
void xbt_os_thread_mod_postexit(void)
int xbt_os_thread_atfork(void (*prepare)(void),
void (*parent)(void), void (*child)(void))
{
int xbt_os_thread_atfork(void (*prepare)(void),
void (*parent)(void), void (*child)(void))
{
+#ifdef WIN32
+ xbt_die("Function pthread_atfork not implemented");
+#else
return pthread_atfork(prepare, parent, child);
return pthread_atfork(prepare, parent, child);
+#endif
}
static void *wrapper_start_routine(void *s)
}
static void *wrapper_start_routine(void *s)
@@
-149,7
+153,7
@@
static void *wrapper_start_routine(void *s)
THROWF(system_error, errcode,
"pthread_setspecific failed for xbt_self_thread_key");
THROWF(system_error, errcode,
"pthread_setspecific failed for xbt_self_thread_key");
- void *res =
(*(t->start_routine))
(t->param);
+ void *res =
t->start_routine
(t->param);
if (t->detached)
xbt_os_thread_free_thread_data(t);
return res;
if (t->detached)
xbt_os_thread_free_thread_data(t);
return res;
@@
-495,7
+499,7
@@
xbt_os_sem_t xbt_os_sem_init(unsigned int value)
if ((res->ps == (sem_t *) SEM_FAILED) && (errno == ENAMETOOLONG)) {
/* Old darwins only allow 13 chars. Did you create *that* amount of semaphores? */
res->name[13] = '\0';
if ((res->ps == (sem_t *) SEM_FAILED) && (errno == ENAMETOOLONG)) {
/* Old darwins only allow 13 chars. Did you create *that* amount of semaphores? */
res->name[13] = '\0';
- res->ps = sem_open(res->name, O_CREAT, 0644,
1
);
+ res->ps = sem_open(res->name, O_CREAT, 0644,
value
);
}
if ((res->ps == (sem_t *) SEM_FAILED))
THROWF(system_error, errno, "sem_open() failed: %s", strerror(errno));
}
if ((res->ps == (sem_t *) SEM_FAILED))
THROWF(system_error, errno, "sem_open() failed: %s", strerror(errno));
@@
-729,8
+733,7
@@
void xbt_os_thread_join(xbt_os_thread_t thread, void **thread_return)
CloseHandle(thread->handle);
CloseHandle(thread->handle);
- if (thread->name)
- free(thread->name);
+ free(thread->name);
free(thread);
}
free(thread);
}