Steampunk sewers

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. 

 

 API overview:

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.

 

Download Source:

This is intended to be compiled with the m68k-atari-mint crosscompiler. If you want to compile with native gcc,
you either have to adjust the Makefile variable or just pass the approriate make variables.

mintthread-0.1.zip

Letzte Änderung: Tuesday, June 19 2012 @ 08:17 pm CEST|Angezeigt: 1,704

FreeMint and concurrent Multi-Threading | 0 Kommentar(e) | Neuen Account anlegen
Die folgenden Kommentare geben Meinungen von Lesern wieder und entsprechen nicht notwendigerweise der Meinung der Betreiber dieser Site. Die Betreiber behalten sich die Löschung von Kommentaren vor.