• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: mach_thread_policy() link error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mach_thread_policy() link error


  • Subject: Re: mach_thread_policy() link error
  • From: "Roni Music" <email@hidden>
  • Date: Sat, 1 Mar 2003 11:41:31 +0100

> Message: 2
> Date: Fri, 28 Feb 2003 17:10:09 -0800
> Subject: Re: mach_thread_policy() link error
> From: Stephen Davis <email@hidden>
> To: email@hidden
>
> You are getting link errors b/c the compiler is assuming
> mach_thread_policy() is a c++ function. The mach headers do not
> properly guard themselves against c++ so you need to do something like
> the following:
>
> extern "C"
> {
> #include <mach/mach.h>
> }
>
> stephen

Thanks!
That made it

but when calling them, they return error

I create the thread which works but when calling thread_policy_set() afterwards, it fails.
Any idea??

pthread_t theThreadId;

if(pthread_create(&theThreadId, NULL, mypthreadEntry, this) != 0)
{
// some error
}


kern_return_t error;
thread_extended_policy_data_t extendedPolicy;
thread_precedence_policy_data_t precedencePolicy;


extendedPolicy.timeshare = 0;
error = thread_policy_set((unsigned int)theThreadId, THREAD_EXTENDED_POLICY, (thread_policy_t)&extendedPolicy, THREAD_EXTENDED_POLICY_COUNT);

if (error != KERN_SUCCESS)
{
// some error
}

precedencePolicy.importance = 6; // or some other value
error = thread_policy_set((unsigned int)theThreadId, THREAD_PRECEDENCE_POLICY, (thread_policy_t )&precedencePolicy, THREAD_PRECEDENCE_POLICY_COUNT);
if (error != KERN_SUCCESS)
{
// some error
}



Thanks
Rolf


>
> On Friday, February 28, 2003, at 04:45 PM, Roni Music wrote:
>
> > Hi,
> >
> > This may have been discussed before?
> >
> > Replacing the MPLibrary stuff with pthreads / mach_thread_policy()
> >
> > using CodeWarrior 8.3
> > Mach-O application
> > C++
> >
> > what framework/library is needed to link to
> > mach_thread_policy() ??
> >
> > Thanks for any help
> >
> > Rolf Nilssson
>
> --__--__--
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: mach_thread_policy() link error
      • From: Bill Stewart <email@hidden>
  • Prev by Date: mach_thread_policy() link error
  • Next by Date: Re: audio computation and feeder threads
  • Previous by thread: mach_thread_policy() link error
  • Next by thread: Re: mach_thread_policy() link error
  • Index(es):
    • Date
    • Thread