Post

Replies

Boosts

Views

Activity

Task policy of an ANSI C program
Hi, I have developed and ported a sequencer to Apple macOS. It is written in ANSI C and uses Gtk+-3.0 (Gimp Toolkit) for UI. This toolkit uses some Cocoa specific backend, note there are different backends for different platforms available. After some research I have found this: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html#//apple_ref/doc/uid/TP30000905-CH211-BABCHEEB The function I wanted to use was: thread_policy_set() But the header file doesn't contain it: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/task_policy.h So was it deprecated? Howto do this, nowadays? 		struct task_category_policy tcatpolicy; 		int ret; 		tcatpolicy.role = TASK_FOREGROUND_APPLICATION; 		if((ret = task_policy_set(mach_task_self(), 			TASK_CATEGORY_POLICY, (thread_policy_t)&tcatpolicy, 			TASK_CATEGORY_POLICY_COUNT)) != KERN_SUCCESS) { 			fprintf(stderr, "set_my_task_policy() failed.\n"); 		} Because the UI animation performance is really bad. The threads interfacing CoreAudio are fine. The UI thread is usually the main thread of the process.
0
0
712
Dec ’20