Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rpj
committed
Mar 1, 2011
1 parent
66bdef4
commit 5b18428
Showing
4 changed files
with
515 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,97 +1,97 @@ | |||
/* | /* | ||
* pthread_attr_setstackaddr.c | * pthread_attr_setstackaddr.c | ||
* | * | ||
* Description: | * Description: | ||
* This translation unit implements operations on thread attribute objects. | * This translation unit implements operations on thread attribute objects. | ||
* | * | ||
* -------------------------------------------------------------------------- | * -------------------------------------------------------------------------- | ||
* | * | ||
* Pthreads-win32 - POSIX Threads Library for Win32 | * Pthreads-win32 - POSIX Threads Library for Win32 | ||
* Copyright(C) 1998 John E. Bossom | * Copyright(C) 1998 John E. Bossom | ||
* Copyright(C) 1999,2005 Pthreads-win32 contributors | * Copyright(C) 1999,2005 Pthreads-win32 contributors | ||
* | * | ||
* Contact Email: rpj@callisto.canberra.edu.au | * Contact Email: rpj@callisto.canberra.edu.au | ||
* | * | ||
* The current list of contributors is contained | * The current list of contributors is contained | ||
* in the file CONTRIBUTORS included with the source | * in the file CONTRIBUTORS included with the source | ||
* code distribution. The list can also be seen at the | * code distribution. The list can also be seen at the | ||
* following World Wide Web location: | * following World Wide Web location: | ||
* http://sources.redhat.com/pthreads-win32/contributors.html | * http://sources.redhat.com/pthreads-win32/contributors.html | ||
* | * | ||
* This library is free software; you can redistribute it and/or | * This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | * modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | * License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | * version 2 of the License, or (at your option) any later version. | ||
* | * | ||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | ||
* | * | ||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | ||
* License along with this library in the file COPYING.LIB; | * License along with this library in the file COPYING.LIB; | ||
* if not, write to the Free Software Foundation, Inc., | * if not, write to the Free Software Foundation, Inc., | ||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
*/ | */ | ||
|
|
||
#include "pthread.h" | #include "pthread.h" | ||
#include "implement.h" | #include "implement.h" | ||
|
|
||
|
|
||
int | int | ||
pthread_attr_setstackaddr (pthread_attr_t * attr, void *stackaddr) | pthread_attr_setstackaddr (pthread_attr_t * attr, void *stackaddr) | ||
/* | /* | ||
* ------------------------------------------------------ | * ------------------------------------------------------ | ||
* DOCPUBLIC | * DOCPUBLIC | ||
* Threads created with 'attr' will run on the stack | * Threads created with 'attr' will run on the stack | ||
* starting at 'stackaddr'. | * starting at 'stackaddr'. | ||
* Stack must be at least PTHREAD_STACK_MIN bytes. | * Stack must be at least PTHREAD_STACK_MIN bytes. | ||
* | * | ||
* PARAMETERS | * PARAMETERS | ||
* attr | * attr | ||
* pointer to an instance of pthread_attr_t | * pointer to an instance of pthread_attr_t | ||
* | * | ||
* stackaddr | * stackaddr | ||
* the address of the stack to use | * the address of the stack to use | ||
* | * | ||
* | * | ||
* DESCRIPTION | * DESCRIPTION | ||
* Threads created with 'attr' will run on the stack | * Threads created with 'attr' will run on the stack | ||
* starting at 'stackaddr'. | * starting at 'stackaddr'. | ||
* Stack must be at least PTHREAD_STACK_MIN bytes. | * Stack must be at least PTHREAD_STACK_MIN bytes. | ||
* | * | ||
* NOTES: | * NOTES: | ||
* 1) Function supported only if this macro is | * 1) Function supported only if this macro is | ||
* defined: | * defined: | ||
* | * | ||
* _POSIX_THREAD_ATTR_STACKADDR | * _POSIX_THREAD_ATTR_STACKADDR | ||
* | * | ||
* 2) Create only one thread for each stack | * 2) Create only one thread for each stack | ||
* address.. | * address.. | ||
* | * | ||
* 3) Ensure that stackaddr is aligned. | * 3) Ensure that stackaddr is aligned. | ||
* | * | ||
* RESULTS | * RESULTS | ||
* 0 successfully set stack address, | * 0 successfully set stack address, | ||
* EINVAL 'attr' is invalid | * EINVAL 'attr' is invalid | ||
* ENOSYS function not supported | * ENOSYS function not supported | ||
* | * | ||
* ------------------------------------------------------ | * ------------------------------------------------------ | ||
*/ | */ | ||
{ | { | ||
#if defined( _POSIX_THREAD_ATTR_STACKADDR ) | #if defined( _POSIX_THREAD_ATTR_STACKADDR ) | ||
|
|
||
if (ptw32_is_attr (attr) != 0) | if (ptw32_is_attr (attr) != 0) | ||
{ | { | ||
return EINVAL; | return EINVAL; | ||
} | } | ||
|
|
||
(*attr)->stackaddr = stackaddr; | (*attr)->stackaddr = stackaddr; | ||
return 0; | return 0; | ||
|
|
||
#else | #else | ||
|
|
||
return ENOSYS; | return ENOSYS; | ||
|
|
||
#endif /* _POSIX_THREAD_ATTR_STACKADDR */ | #endif /* _POSIX_THREAD_ATTR_STACKADDR */ | ||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,76 +1,76 @@ | |||
/* | /* | ||
* pthread_equal.c | * pthread_equal.c | ||
* | * | ||
* Description: | * Description: | ||
* This translation unit implements miscellaneous thread functions. | * This translation unit implements miscellaneous thread functions. | ||
* | * | ||
* -------------------------------------------------------------------------- | * -------------------------------------------------------------------------- | ||
* | * | ||
* Pthreads-win32 - POSIX Threads Library for Win32 | * Pthreads-win32 - POSIX Threads Library for Win32 | ||
* Copyright(C) 1998 John E. Bossom | * Copyright(C) 1998 John E. Bossom | ||
* Copyright(C) 1999,2005 Pthreads-win32 contributors | * Copyright(C) 1999,2005 Pthreads-win32 contributors | ||
* | * | ||
* Contact Email: rpj@callisto.canberra.edu.au | * Contact Email: rpj@callisto.canberra.edu.au | ||
* | * | ||
* The current list of contributors is contained | * The current list of contributors is contained | ||
* in the file CONTRIBUTORS included with the source | * in the file CONTRIBUTORS included with the source | ||
* code distribution. The list can also be seen at the | * code distribution. The list can also be seen at the | ||
* following World Wide Web location: | * following World Wide Web location: | ||
* http://sources.redhat.com/pthreads-win32/contributors.html | * http://sources.redhat.com/pthreads-win32/contributors.html | ||
* | * | ||
* This library is free software; you can redistribute it and/or | * This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | * modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | * License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | * version 2 of the License, or (at your option) any later version. | ||
* | * | ||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | ||
* | * | ||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | ||
* License along with this library in the file COPYING.LIB; | * License along with this library in the file COPYING.LIB; | ||
* if not, write to the Free Software Foundation, Inc., | * if not, write to the Free Software Foundation, Inc., | ||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
*/ | */ | ||
|
|
||
#include "pthread.h" | #include "pthread.h" | ||
#include "implement.h" | #include "implement.h" | ||
|
|
||
|
|
||
int | int | ||
pthread_equal (pthread_t t1, pthread_t t2) | pthread_equal (pthread_t t1, pthread_t t2) | ||
/* | /* | ||
* ------------------------------------------------------ | * ------------------------------------------------------ | ||
* DOCPUBLIC | * DOCPUBLIC | ||
* This function returns nonzero if t1 and t2 are equal, else | * This function returns nonzero if t1 and t2 are equal, else | ||
* returns zero | * returns zero | ||
* | * | ||
* PARAMETERS | * PARAMETERS | ||
* t1, | * t1, | ||
* t2 | * t2 | ||
* thread IDs | * thread IDs | ||
* | * | ||
* | * | ||
* DESCRIPTION | * DESCRIPTION | ||
* This function returns nonzero if t1 and t2 are equal, else | * This function returns nonzero if t1 and t2 are equal, else | ||
* returns zero. | * returns zero. | ||
* | * | ||
* RESULTS | * RESULTS | ||
* non-zero if t1 and t2 refer to the same thread, | * non-zero if t1 and t2 refer to the same thread, | ||
* 0 t1 and t2 do not refer to the same thread | * 0 t1 and t2 do not refer to the same thread | ||
* | * | ||
* ------------------------------------------------------ | * ------------------------------------------------------ | ||
*/ | */ | ||
{ | { | ||
int result; | int result; | ||
|
|
||
/* | /* | ||
* We also accept NULL == NULL - treating NULL as a thread | * We also accept NULL == NULL - treating NULL as a thread | ||
* for this special case, because there is no error that we can return. | * for this special case, because there is no error that we can return. | ||
*/ | */ | ||
result = ( t1.p == t2.p && t1.x == t2.x ); | result = ( t1.p == t2.p && t1.x == t2.x ); | ||
|
|
||
return (result); | return (result); | ||
|
|
||
} /* pthread_equal */ | } /* pthread_equal */ |
Oops, something went wrong.