Skip to content

Instantly share code, notes, and snippets.

Created August 22, 2016 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/468565d977b13fb5380680a7ac61470b to your computer and use it in GitHub Desktop.
Save anonymous/468565d977b13fb5380680a7ac61470b to your computer and use it in GitHub Desktop.
pthread_attr_t loThreadAttributes;
struct sched_param loThreadSchedulingParameters;
pthread_attr_init(&loThreadAttributes);
pthread_attr_setschedpolicy(&loThreadAttributes, SCHED_RR);
loThreadSchedulingParameters.sched_priority = 1;
pthread_attr_setschedparam(&loThreadAttributes, &loThreadSchedulingParameters);
bool lbResult = pthread_create(ppnHandle, &loThreadAttributes, pfRoutine, poArguments) == 0;
if (lbResult)
{
pthread_detach(*ppnHandle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment