Solved

pthread threads under Windows respond very slow

Posted on 2006-07-18
4
366 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
ID: 17131026
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
ID: 17131379

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to declare a 2-dimensional version of strlen 4 200
Way to improve it 16 61
C++ finding a sting in a char* string from a text file 3 99
convert char array to number in c 5 83
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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

920 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

14 Experts available now in Live!

Get 1:1 Help Now