FreeMint and concurrent Multi-Threading
I have found an way, hidden in the minttlib, to create concurrent threads with MiNT. The function which offers multi-threading is called tfork(). However, it has some double free / race condition bug.
Not just because of that, I decided to code a little wrapper / fix the bug within tfork().
In the end I would like to have accomplished the followin goal:
- save way of doing memory allocations within threads ( currently this is a no-go! )
This page was just setup to provide the early version of this library.
int32_t init_threads( void ); int32_t beginthread(int (*func)(long), long stacksize, long arg); int16_t tls_key_alloc( void ); int32_t tls_key_release( uint16_t key ); int32_t tls_key_set( uint16_t key, uint32_t value ); int32_t tls_key_get( uint16_t key, uint32_t * value ); int32_t init_critical_section( struct critical_section_s * cs ); int32_t try_enter_critical_section( struct critical_section_s * cs ); int32_t enter_critical_section( struct critical_section_s * cs ); int32_t leave_critical_section( struct critical_section_s * cs ); int32_t delete_critical_section( struct critical_section_s * cs );
Small example program:
To be done ;) Look in the source "test.c" for now.
This is intended to be compiled with the m68k-atari-mint crosscompiler. If you want to compile with native gcc,
Letzte Änderung: Tuesday, June 19 2012 @ 08:17 pm CEST|Angezeigt: 1,747
Copyright © 2017 MONOCHROM.NET
All trademarks and copyrights on this page are owned by their respective owners.
Powered by Geeklog
Seite erzeugt in 0.04 Sekunden