• 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: Bill Stewart <email@hidden>
  • Date: Sat, 1 Mar 2003 18:02:44 -0800

Take a look at the code in AudioFilePlay in the CoreAudio SDK's PublicUtility folder

That works just fine and will give you the policy and priority you desire

Bill

On Saturday, March 1, 2003, at 02:41 AM, Roni Music wrote:

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.


-- mailto:email@hidden
tel: +1 408 974 4056

________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __
_______________________________________________
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.
References: 
 >Re: mach_thread_policy() link error (From: "Roni Music" <email@hidden>)

  • Prev by Date: Re: AU, Rax, multiple windows
  • Next by Date: ANN: SONOSPHERE - AU HOST
  • Previous by thread: Re: mach_thread_policy() link error
  • Next by thread: Re: mach_thread_policy() link error
  • Index(es):
    • Date
    • Thread