… | |
… | |
31 | #include <sys/time.h> |
31 | #include <sys/time.h> |
32 | #include <time.h> |
32 | #include <time.h> |
33 | #include <signal.h> |
33 | #include <signal.h> |
34 | |
34 | |
35 | #include <global.h> |
35 | #include <global.h> |
36 | #include <funcpoint.h> |
|
|
37 | #include <material.h> |
36 | #include <material.h> |
38 | |
37 | |
39 | #include <glib.h> |
38 | #include <glib.h> |
40 | |
39 | |
41 | refcnt_base::refcnt_t refcnt_dummy; |
40 | refcnt_base::refcnt_t refcnt_dummy; |
… | |
… | |
649 | 0x2d02ef8dL |
648 | 0x2d02ef8dL |
650 | }; |
649 | }; |
651 | |
650 | |
652 | void thread::start (void *(*start_routine)(void *), void *arg) |
651 | void thread::start (void *(*start_routine)(void *), void *arg) |
653 | { |
652 | { |
|
|
653 | pthread_attr_t attr; |
|
|
654 | |
|
|
655 | pthread_attr_init (&attr); |
|
|
656 | pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); |
|
|
657 | pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN < sizeof (long) * 4096 |
|
|
658 | ? sizeof (long) * 4096 : PTHREAD_STACK_MIN); |
|
|
659 | #ifdef PTHREAD_SCOPE_PROCESS |
|
|
660 | pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS); |
|
|
661 | #endif |
|
|
662 | |
654 | sigset_t fullsigset, oldsigset; |
663 | sigset_t fullsigset, oldsigset; |
655 | sigfillset (&fullsigset); |
664 | sigfillset (&fullsigset); |
656 | |
665 | |
657 | pthread_sigmask (SIG_SETMASK, &fullsigset, &oldsigset); |
666 | pthread_sigmask (SIG_SETMASK, &fullsigset, &oldsigset); |
658 | |
667 | |
659 | if (pthread_create (&id, 0, start_routine, arg)) |
668 | if (pthread_create (&id, &attr, start_routine, arg)) |
660 | cleanup ("unable to create a new thread"); |
669 | cleanup ("unable to create a new thread"); |
661 | |
670 | |
662 | pthread_sigmask (SIG_SETMASK, &oldsigset, 0); |
671 | pthread_sigmask (SIG_SETMASK, &oldsigset, 0); |
663 | } |
672 | } |
|
|
673 | |