| Bug #8369 | cluster restart -n fails compiled with linux threads | ||
|---|---|---|---|
| Submitted: | 8 Feb 2005 14:32 | Modified: | 10 Feb 2005 13:21 |
| Reporter: | Tomas Ulin | Email Updates: | |
| Status: | To be fixed later | ||
| Category: | Server: Cluster | Severity: | S3 (Non-critical) |
| Version: | 4.1 5.0 | OS: | FreeBSD (freebsd with linux threads) |
| Assigned to: | Tomas Ulin | Target Version: | |
[8 Feb 2005 14:32]
Tomas Ulin
[10 Feb 2005 11:28]
Tomas Ulin
linux threads is too broken to bother porting cluster to it. We will not build with linux threads
[10 Feb 2005 12:32]
Tomas Ulin
I apologize for the comment above.
[10 Feb 2005 13:21]
Tomas Ulin
unfortunately we can't get ndb to work on FreeBSD with linuxthreads until the problem
shown in the example program is fixed.
when this issue is resolved, we will try again.
/*
To test the program, do:
gcc -I/usr/local/include/pthread/linuxthreads -o tmp tmp.c -L/usr/local/lib -llthread ;
./tmp
If it works, it should end with:
Exit value 123, should be 123
For us the result is:
Exit value 123, should be 123
thread: exit
child: exit
Exit value 0, should be 123
We know that this program works if we do:
gcc -o tmp tmp.c -L/usr/local/lib -pthread ; ./tmp
But this doesn't solve the problem of using NDB with linuxthreads
*/
/*
#define LINUXTHREADS_WRAP_API yes
This program may work with linuxthreads compiled with:
#define LINUXTHREADS_DETECT_UNSAFE_EXIT
but for our purposes this have to work with any installed linux threads
library
*/
#include <pthread.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
void wait_and_display(pid_t pid)
{
int status;
while ( pid != waitpid(pid, &status, 0) );
printf("Exit value %d, should be 123\n", WEXITSTATUS(status));
}
void *athread(void *data)
{
printf("thread: exit\n");
pthread_exit(0);
}
int main(void)
{
pid_t pid;
/* Case 1: Explicit call to exit */
if ((pid = fork()) == 0) /* child */
exit(123);
/* parent */
wait_and_display(pid);
/* Case 2: Start thread and Explicit call to exit */
if ((pid = fork()) == 0) /* child */
{
pthread_t thread;
pthread_attr_t thread_attr;
int result;
pthread_attr_init(&thread_attr);
result = pthread_create(&thread,
&thread_attr,
athread,
0);
sleep(2);
printf("child: exit\n");
exit(123);
}
/* parent */
wait_and_display(pid);
exit(0);
}
