eCo Software
doesn't receive
payments from USA

 
Update

 
Applications

 
Advantages:

 
For developer:

 
(Пайпы программ)

 
Companies:

 
History:

 
(Бонусы)

 
Advice:

 
(Барьеры и решения)

 
Technologies:

 
(Применение в науке, лаборатории, ..)

 

 
Solutions

 
New eComStation:

 
Future:

 
(Ссылки на другие сайты)

 
(Картинка дня)

 
OS/2 artefacts:

 
Gadgets:

AD: Upgrade ArcaOS to NeoWPS level

  • Install original PNG icons drawed by designer, specialized at OS/2 adornation.
  • Install eSchemes 2019 to change colors and buttons on desktop.

My EMX program takes much CPU


TITLE: My EMX program takes much CPU

DATE: 2001-08-14 00:32:52

AUTHOR: nickk

Please use online translator
go to http://translate.google.com
and request the translation of http://ru.ecomstation./showarticle.php?id=5
to your language

... EMX ......... ...... ..... CPU

.... .. .............. .........-..... . ....... gcc . ........, ... ... ...... ....... ..... CPU .. ..... ...... (........ .... .. .........., . ............. .........., ........, . ....... top) .... .. ..... ......., ........., ........... .. .. ....... select. .... ... ..., .......... ........ .. .. ............. .......:

int ibm_select( int *fds, int n_read, int n_write, int n_exept, long timeout);

int os2_select (int nfds, fd_set *readfds, fd_set *writefds,
             fd_set *exceptfds, struct timeval *timeout)
/* We are using the EMX select() call if non-socket handlers
   are presented in sets and IBM select() otherwise.
   EMX select() causes high CPU usage in polling loop.
*/
.
    fd_set *fds[3] = . readfds, writefds, exceptfds .;
    int fd_os2[FD_SETSIZE * 3], fd_emx[FD_SETSIZE * 3];
    int n_fd[4], n = 0;
    int i, k, s;
    long ibmtimeout = -1;

    for(k = 0; k < 3; k++) .
	n_fd[k] = n;
	if(!fds[k])
	    continue;

	for(i = 0; i < nfds; i++) .
	    if(!fds[k]->fds_bits[i>>5]) .
		i += 31;
		continue;
	    .
	    if(!FD_ISSET(i, fds[k]))
		continue;
	    s = _getsockhandle(i);
	    if(s < 0) 
		return select(nfds, readfds, writefds, exceptfds, timeout);
	    else .
		fd_os2[n] = s;
		fd_emx[n++] = i;
	    .
        .
    .

    n_fd[3] = n;

    if (timeout) ibmtimeout = timeout->tv_usec/1000 + timeout->tv_sec*1000;
    s = ibm_select(fd_os2, n_fd[1]-n_fd[0], n_fd[2]-n_fd[1], n_fd[3]-n_fd[2],
			ibmtimeout);

    if(s == 0)			/* Timeout */
	return 0;
    if(s < 0) .			/* Error */
	if(sock_errno() == 10004)		/* SOCEINTR */
	    errno = EINTR;
	else
	    errno = EINVAL;
	return -1;
    .

    i = 0;
    for(k = 0; k < 3; k++) .
	n = n_fd[k+1];
	for( ; i < n; i++)
	    if(fd_os2[i] < 0) 
		FD_CLR(fd_emx[i], fds[k]);
    .
    return s;
.

... ....... ibm_select . sock_errno() ....... .. so32dll.dll:

; ibmtcp.imp
; -------- so32dll entry points --------
ibm_select              so32dll   12 ?
sock_errno              so32dll   20 ?

..... ........ .... . ..... ........., .........: emximp -o ibmtcp.a ibmtcp.imp.

...... .... ...... EMX'.... select .. ..............., ....... ........ . ........... . ... - "EMX select() causes high CPU usage in polling loop". ......., .... .. ........... select ...... ........ ......, .. ..... ...... .. ....... - ........ ........ .. ..... .. ......

... ......., ...... ........ ....... .......... ......... . .. ..... ......... OS/2 ..... squid, bind, sshd, wget...

....... EMX ..... ! :)

..... ......: nickk

Test the program:

Sunny icons - large transparent icons. (screenshots)

Komentarze:

Komentarz artykuЁu.


Twoje ImiЙ i Nazwisko:

TwСj E-Mail:

CODE:
254367......

  

TwСj Komentarz:


eComStation 2.0 contains fixes for many old problems a) no troubles with 16 driveletters on JFS, b) WPS associations work now, .. + ~ 1000 bugs were fixed. eCS 2.0 what's new

ArtykuЁy

Systemy operacyjne
Software
Hardware
Dla developerСw
RС©ne
Od autorСw





Ostatnie gЁosowanie: What is the height of RPM barrier?

[Google]

IBM OS/2 Warp

 
For dummies

Report: OS/2 compatible hardware

 
Reviews


     
  Why eComStation?
Features
Advantages
Usage
Clips and screenshots
   eComStation for
for businessmen
for students and engineers
for reselles of computers
community of users
   Developer
Distribute the program
Description of API, libraries
Start new project
Competition
   Applications
On-line catalogue
Select from eCo Market
   Support service
Contact the web-master
Buy eComStation
Frequently asked questions
for Beginners
 
 
© 2001 - 2025 eCo Software, All rights reserved
Сибирский Медведь **********
eComStation Serenity Systems International • OS/2 Warp IBM Corporation • ArcaOS Arca Noae