Daniel Schnell wrote:
> Hi,
>
>
> attached you find a test program that will badly crash here on our
> ELDK4.0 based MPC5200 board.
>
> It will create a bunch of tasks, which itself will allocate different
> amount of memory, clock_nanosleep() afterwards and return the allocated
> memory back to the system pool.
> If one gives a reasonable high number as command line argument (number
> of tasks to spawn), you will certainly starve the system memory pretty
> soon.
>
> There are several (probably unrelated) issues you can trigger with this:
>
> 1.) Without setting an ulimit -s, just using the standard linux stack
> space and calling it with
You should set the threads stack size with pthread_attr_setstacksize (as
other pthread_attr_set* functions, it should be used on a previously
initialized pthread_attr_t structure), ulimit -s only set the stack size
of the main thread, at least on some architectures.
This is probably unrelated to the errors you see, but:
- passing the pthread_mutex_t by value is not supposed to work; once a
pthread_mutex_t is initialized with pthread_mutex_init, you should pass
the address of the very same pthread_mutex_t to other functions of the API.
- pthread_t, on the other hand is an identifier, and may be passed by
value; if you look at functions taking pthread_t as argument, they all
take the argument by value, except pthread_create. So allocating some
space for these identifiers is useless.
Now, about the errors you see, it would be nice if you could separate
the two issues: could you try hitting ctrl-C when running your program
with stacks small enough so that there is enough room.
--
Gilles Chanteperdrix
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help