mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
branches/zip:
Check that pthread_t can indeed be passed to Solaris atomic functions, instead of assuming that it can be passed if 0 can be assigned to it. It could be that: * 0 can be assigned, but pthread_t cannot be passed and * 0 cannot be assigned but pthread_t can be passed Better to check what we are interested in, not something else and make assumptions.
This commit is contained in:
parent
cc78975784
commit
ae766b35f5
1 changed files with 22 additions and 3 deletions
|
@ -17,8 +17,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
If this program compiles, then pthread_t objects can be used as arguments
|
||||
to Solaris libc atomic functions.
|
||||
If this program compiles and returns 0, then pthread_t objects can be used as
|
||||
arguments to Solaris libc atomic functions.
|
||||
|
||||
Created April 18, 2009 Vasil Dimov
|
||||
*****************************************************************************/
|
||||
|
@ -28,7 +28,26 @@ Created April 18, 2009 Vasil Dimov
|
|||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
pthread_t x = 0;
|
||||
pthread_t x1;
|
||||
pthread_t x2;
|
||||
pthread_t x3;
|
||||
|
||||
memset(&x1, 0x0, sizeof(x1));
|
||||
memset(&x2, 0x0, sizeof(x2));
|
||||
memset(&x3, 0x0, sizeof(x3));
|
||||
|
||||
if (sizeof(pthread_t) == 4) {
|
||||
|
||||
atomic_cas_32(&x1, x2, x3);
|
||||
|
||||
} else if (sizeof(pthread_t) == 8) {
|
||||
|
||||
atomic_cas_64(&x1, x2, x3);
|
||||
|
||||
} else {
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue