Solved

pthread threads under Windows respond very slow

Posted on 2006-07-18
4
354 Views
Last Modified: 2008-02-01
An IO interrupt service function is bound to a thread created with phtread_create
(Win32). When an interrupt condition arises (IO set/reset), it takes considerable amounts of
times until the service function starts processing.
Is there a way to raise the priority of the thread ? I tried with scheduling attributes,
and detaching - with no effect.
0
Comment
Question by:Shony
4 Comments
 
LVL 12

Accepted Solution

by:
rajeev_devin earned 250 total points
Comment Utility
Did you use this function pthread_setschedparam(...) ?

Check this link for details
http://www.cs.cf.ac.uk/Dave/C/node29.html#SECTION0029414000000000000000
0
 
LVL 8

Assisted Solution

by:manish_regmi
manish_regmi earned 250 total points
Comment Utility

One way is to set the priority of the thread to maximim. as rajeev said use
int pthread_setschedparam(pthread_t thread, int policy,
    const struct sched_param *param);

struct sched_param param;

param.sched_priority  = sched_get_priority_max(SCHED_OTHER); // or whatever your policy is

But this will not gurantee the realtime response in your interrupt service. Due to the non realtime nature of windows, your service routine may run a little later (may be few milliseconds).

regards
Manish Regmi

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now