Commit graph

15 commits

Author SHA1 Message Date
Lionel Sambuc
d3d33afe9f Experimental pthread compatibility library
This patch adds pthread compatibility by using libmthread.

To use this with a program using pthreads, you have to replace
  #include <pthread>
with
  #define _MTHREADIFY_PTHREADS
  #include <minix/mthreads>

This also changes the initialization function to be a constructor, which
is implicitly called before the call to main. This allows for
conformance with pthreads, while not paying a high price by checking on
each mthread_* call whether the library has been initialized or not.

As mthread_init is now a constructor, it also has been set as static, and
relevent calls removed from programs using it.

Change-Id: I2aa375db557958d2bee9a70d285aabb990c88f00
2014-07-28 17:05:08 +02:00
Ben Gras
5977114c42 tests cleanup
. make common.o link with the tests instead of being
	  #included as common.c
	. fix warnings about missing prototypes by declaring functions
	  static
	. reduces some duplicated code

Change-Id: Ic2a765d7f5886add5863190efec3fdd2d2ea2137
2013-04-17 22:00:59 +00:00
Arun Thomas
fd43d93ce5 ARM support for system libraries 2012-08-28 13:49:27 -04:00
Arun Thomas
6723dcfab7 Replace MACHINE/CHIP macros with compiler macros 2012-08-06 17:49:22 +02:00
Ben Gras
7336a67dfe retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
Ben Gras
6a73e85ad1 retire _PROTOTYPE
. only good for obsolete K&R support
	. also remove a stray ansi.h and the proto cmd
2012-03-25 16:17:10 +02:00
Thomas Veerman
0949f5b342 libmthread: don't free() user allocated stack space 2012-02-13 13:50:13 +00:00
Raja Appuswamy
f9d1614e6d libmthread: add mthread_event_fire_all 2011-12-01 14:53:20 +01:00
Raja Appuswamy
03a8d06668 adding rwlock and event support to mthread 2011-11-29 14:35:22 +01:00
Thomas Veerman
9b43de2cb3 Clean up mthread 2011-07-27 09:30:26 +00:00
David van Moolenbroek
020277a38f libmthread: support for thread-local storage (keys/specifics) 2011-04-14 11:54:43 +00:00
Thomas Veerman
b1a60476c0 Return errors directly instead of using errno 2011-04-13 14:01:13 +00:00
Thomas Veerman
c8d0edc06a - Refactor mthread structure fields to prevent name clashes
- Remove sanity checks for initialized mutexes and condition variables. This
  significantly boosts performance. The checks can be turned back on by
  compiling libmthread with MTHREAD_STRICT. According to POSIX operations on
  uninitialized variables are a MAY fail if, therefore allowing this
  optimization.
- Test59 has to be accommodated to the lack of sanity checks on uninitialized
  variables in the library. It specifically tests for them and will run into
  segfaults when the checks are absent in the library.
- Fix a few bugs related to the scheduler
- Do some general code cleanups
2011-03-18 10:29:54 +00:00
Thomas Veerman
a7072a5e1c Revamp the mthread library and update test59
Before, the 'main thread' of a process was never taken into account anywhere in
the library, causing mutexes not to work properly (and consequently, neither
did the condition variables). For example, if the 'main thread' (that is, the
thread which is started at the beginning of a process; not a spawned thread by
the library) would lock a mutex, it wasn't actually locked.
2010-09-30 13:44:13 +00:00
Thomas Veerman
12e167f672 Add libmthread and test59 to test the implementation 2010-09-21 12:22:38 +00:00