3 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #ifndef _XBT_CONTEXT_PRIVATE_H
9 #define _XBT_CONTEXT_PRIVATE_H
12 #include "xbt/sysdep.h"
14 #include "xbt/dynar.h" /* void_f_pvoid_t */
15 #include "portable.h" /* loads context system definitions */
16 #include "ucontext_stack.h" /* loads context system definitions */
18 #include "xbt/context.h"
22 /* Dummy definition for splint since it chokes on ucontext.h */
23 typedef struct ucontext {
24 struct ucontext *uc_link;
35 # define STACK_SIZE 128*1024 /* Lower this if you want to reduce the memory consumption */
36 #endif /* USE_PTHREADS */
38 typedef struct s_xbt_context {
39 s_xbt_swag_hookup_t hookup;
42 pthread_mutex_t mutex;
43 pthread_t *thread; /* the thread that execute the code */
45 ucontext_t uc; /* the thread that execute the code */
46 char stack[STACK_SIZE];
47 struct s_xbt_context *save;
48 #endif /* USE_PTHREADS */
49 xbt_context_function_t code; /* the scheduler fonction */
52 void_f_pvoid_t *startup_func;
54 void_f_pvoid_t *cleanup_func;
56 ex_ctx_t *exception; /* exception */
60 #endif /* _XBT_CONTEXT_PRIVATE_H */