mirror of
				https://gitlab.com/sortix/sortix.git
				synced 2023-02-13 20:55:38 -05:00 
			
		
		
		
	Add pthread_attr_init(3) and pthread_attr_destroy(3).
This commit is contained in:
		
							parent
							
								
									dc44b65d01
								
							
						
					
					
						commit
						e3eba51a94
					
				
					 5 changed files with 75 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -11,6 +11,8 @@ CPPFLAGS:=$(CPPFLAGS) -D__is_sortix_libpthread -I include
 | 
			
		|||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
 | 
			
		||||
 | 
			
		||||
OBJS=\
 | 
			
		||||
pthread_attr_destroy.o \
 | 
			
		||||
pthread_attr_init.o \
 | 
			
		||||
pthread_condattr_destroy.o \
 | 
			
		||||
pthread_condattr_getclock.o \
 | 
			
		||||
pthread_condattr_init.o \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,15 @@ __BEGIN_DECLS
 | 
			
		|||
 | 
			
		||||
#define __sortix_libpthread__ 1
 | 
			
		||||
 | 
			
		||||
typedef int __pthread_attr_t;
 | 
			
		||||
#if defined(__is_sortix_libpthread)
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
} __pthread_attr_t;
 | 
			
		||||
#else
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
} __pthread_attr_t;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef int __pthread_barrier_t;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,7 +185,7 @@ struct pthread* pthread_allocate_tls(void);
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
/* TODO: pthread_atfork */
 | 
			
		||||
/* TODO: pthread_attr_destroy */
 | 
			
		||||
int pthread_attr_destroy(pthread_attr_t*);
 | 
			
		||||
/* TODO: pthread_attr_getdetachstate */
 | 
			
		||||
/* TODO: pthread_attr_getguardsize */
 | 
			
		||||
/* TODO: pthread_attr_getinheritsched */
 | 
			
		||||
| 
						 | 
				
			
			@ -194,7 +194,7 @@ struct pthread* pthread_allocate_tls(void);
 | 
			
		|||
/* TODO: pthread_attr_getscope */
 | 
			
		||||
/* TODO: pthread_attr_getstack */
 | 
			
		||||
/* TODO: pthread_attr_getstacksize */
 | 
			
		||||
/* TODO: pthread_attr_init */
 | 
			
		||||
int pthread_attr_init(pthread_attr_t*);
 | 
			
		||||
/* TODO: pthread_attr_setdetachstate */
 | 
			
		||||
/* TODO: pthread_attr_setguardsize */
 | 
			
		||||
/* TODO: pthread_attr_setinheritsched */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										30
									
								
								libpthread/pthread_attr_destroy.c++
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								libpthread/pthread_attr_destroy.c++
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
/*******************************************************************************
 | 
			
		||||
 | 
			
		||||
    Copyright(C) Jonas 'Sortie' Termansen 2013.
 | 
			
		||||
 | 
			
		||||
    This file is part of Sortix libpthread.
 | 
			
		||||
 | 
			
		||||
    Sortix libpthread is free software: you can redistribute it and/or modify it
 | 
			
		||||
    under the terms of the GNU Lesser General Public License as published by the
 | 
			
		||||
    Free Software Foundation, either version 3 of the License, or (at your
 | 
			
		||||
    option) any later version.
 | 
			
		||||
 | 
			
		||||
    Sortix libpthread is distributed in the hope that it will be useful, but
 | 
			
		||||
    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 | 
			
		||||
    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 | 
			
		||||
    License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU Lesser General Public License
 | 
			
		||||
    along with Sortix libpthread. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    pthread_attr_destroy.c++
 | 
			
		||||
    Destroys a thread attributes object.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <pthread.h>
 | 
			
		||||
 | 
			
		||||
extern "C" int pthread_attr_destroy(pthread_attr_t* /*attr*/)
 | 
			
		||||
{
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								libpthread/pthread_attr_init.c++
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								libpthread/pthread_attr_init.c++
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
/*******************************************************************************
 | 
			
		||||
 | 
			
		||||
    Copyright(C) Jonas 'Sortie' Termansen 2013.
 | 
			
		||||
 | 
			
		||||
    This file is part of Sortix libpthread.
 | 
			
		||||
 | 
			
		||||
    Sortix libpthread is free software: you can redistribute it and/or modify it
 | 
			
		||||
    under the terms of the GNU Lesser General Public License as published by the
 | 
			
		||||
    Free Software Foundation, either version 3 of the License, or (at your
 | 
			
		||||
    option) any later version.
 | 
			
		||||
 | 
			
		||||
    Sortix libpthread is distributed in the hope that it will be useful, but
 | 
			
		||||
    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 | 
			
		||||
    or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 | 
			
		||||
    License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU Lesser General Public License
 | 
			
		||||
    along with Sortix libpthread. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
    pthread_attr_init.c++
 | 
			
		||||
    Initialize a thread attributes object.
 | 
			
		||||
 | 
			
		||||
*******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include <pthread.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
extern "C" int pthread_attr_init(pthread_attr_t* attr)
 | 
			
		||||
{
 | 
			
		||||
	memset(attr, 0, sizeof(*attr));
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue