Changeset 445 for trunk/libs/libpthread
- Timestamp:
- May 29, 2018, 9:27:23 AM (7 years ago)
- Location:
- trunk/libs/libpthread
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libpthread/Makefile
r444 r445 1 1 ############################################################################ 2 # Makefile for the ALMOS-MKH "mini-pthread"#2 # Makefile for the "pthread" library. # 3 3 ############################################################################ 4 4 5 5 -include ../../params-soft.mk 6 6 7 ifeq ($(ARCH_NAME),) 7 8 $(error Please define in ARCH_NAME parameter in params-soft.mk!) … … 9 10 10 11 SRCS = pthread.c 11 OBJS = $(addprefix build/, $(SRCS:.c=.o))12 # $(HAL_ARCH)/build/core/hal_user.o13 12 14 INCLUDES = -I. -I$(HAL)/generic -I$(LIBC_INCLUDE) -I$(LIBALMOSMKH_INCLUDE) -I$(SHARED_INCLUDE) 13 OBJS = $(addprefix build/, $(SRCS:.c=.o)) \ 14 $(HAL_ARCH)/build/core/hal_user.o 15 15 16 libs : build/lib/libpthread.a headers 16 INCLUDES = -I. \ 17 -I$(LIBC_PATH) \ 18 -I$(LIBALMOSMKH_PATH) \ 19 -I$(SHARED_INCLUDE) \ 20 -I$(HAL)/generic \ 21 -I$(HAL_ARCH)/core \ 22 -I$(KERNEL) 23 24 libs : build/lib/libpthread.a headers 17 25 18 26 build : … … 24 32 $(MAKE) -C $(HAL_ARCH) 25 33 26 ../mini-libc/build/%.o:27 $(MAKE) -C ../libc -f Makefile.tsar28 29 34 build/%.o : %.c %.h 30 35 $(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $< … … 32 37 33 38 headers: build 34 cp $(SRCS:.c=.h) build/include/.39 cp $(SRCS:.c=.h) build/include/. 35 40 36 41 37 build/lib/libpthread.a: build $(OBJS)38 $(AR) rc $@ $(OBJS) #$(OBJS_LIBC)42 build/lib/libpthread.a: build $(OBJS) 43 $(AR) rc $@ $(OBJS) 39 44 $(RANLIB) $@ 40 45 -
trunk/libs/libpthread/pthread.c
r444 r445 1 1 /* 2 * pthread.c - User side pthread related functionsimplementation.2 * pthread.c - User leve <pthread> library implementation. 3 3 * 4 4 * Author Alain Greiner (2016,2017,2018) … … 23 23 24 24 #include <hal_user.h> 25 #include <hal_types.h> 25 26 #include <stdio.h> 26 27 #include <stdlib.h> 27 28 #include <pthread.h> 28 #include <assert.h> 29 #include <almos-mkh.h> 29 #include <almosmkh.h> 30 30 #include <syscalls_numbers.h> 31 31 32 32 #define PTHREAD_MUTEX_DEBUG 0 33 33 #define PTHREAD_BARRIER_DEBUG 0 34 35 #define reg_t int36 34 37 35 //////////////////////////////////////////////////////////////////////////////////////////// … … 205 203 206 204 // check attributes 207 assert( x_size <= QDT_XMAX ); 208 assert( y_size <= QDT_YMAX ); 209 assert( x_size * y_size * nthreads == count ); 205 if( (x_size * y_size * nthreads) != count ) 206 { 207 printf("\[ERROR] in %s : count != x_size * y_size * nthreads/n", __FUNCTION__); 208 exit( EXIT_FAILURE ); 209 } 210 210 211 211 // compute SQT levels … … 319 319 else // not the last thread 320 320 { 321 // poll sense322 321 while( 1 ) 323 322 { 323 // poll sense 324 324 if( node->sense == expected ) break; 325 326 // deschedule 327 pthread_yield(); 325 328 } 326 329 -
trunk/libs/libpthread/pthread.h
r444 r445 1 1 /* 2 * pthread.h - User side pthread relatedlibrary definition.2 * pthread.h - User level <pthread> library definition. 3 3 * 4 4 * Author Alain Greiner (2016,2017) … … 25 25 #define _PTHREAD_H_ 26 26 27 #include <almos-mkh/pthread.h> 28 27 #include <shared_pthread.h> 29 28 30 29 ////////////////////////////////////////////////////////////////////////////////////////////// … … 78 77 int pthread_exit( void * exit_value ); 79 78 80 81 82 // TODO n'existe pas dans pthread83 79 /********************************************************************************************* 84 80 * This function calls the scheduler for the core running the calling thread. 81 * WARNING: It is not defined by POSIX. 85 82 ********************************************************************************************* 86 83 * @ return always 0.
Note: See TracChangeset
for help on using the changeset viewer.