• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: kevent and wait time?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kevent and wait time?


  • Subject: Re: kevent and wait time?
  • From: Dave Zarzycki <email@hidden>
  • Date: Mon, 10 Apr 2006 06:35:52 -0700

After reviewing your code:


int iNev = kevent( iKQ, pkEvents, iNumberOfConnectionsCreated, &kLEvent, 1, NULL /*&timeToWait*/ );


                testModule.Process( kLEvent, iNev );


Please read the man page again. Please note the long standing Unix tradition of returning -1 on failure. I doubt your code is handling that correctly.


Also, please note: Unless you like pain, please don't do the following:

1) Add more than one event at a time.
2) Get more than one event at a time.
3) Add and get events in the same call to kevent().

Those cases, while powerful, are also riddled with complications of use that are far beyond the scope of this e-mail thread. Trust me, you can write very efficient/fast code without using those cases.

Cheers,

davez




On Apr 10, 2006, at 1:57 AM, email@hidden wrote:


Dave,

I'm using the EV_SET macro to add to the queue, but my understanding is that it's calling kevent() to do it.

It does not. It just helps you populate the structure.
If you thought the EV_SET() macro called kevent(), then the rest of your results are called into question.

OK, my bad -- but after re-re-re-re-reading the man page and looking at my code (which seems to work, well, mostly <smile>), it is doing what you indicate ... and I do receive events from only the FDs I put on the kqueue when I call kevent as long as I specify a non-0 timeval.


but I don't see how specifying a timespec with 0 makes kevent() return an event for some FD i've never heard of.

Are you checking the results of kevent()? That'll tell you how many of the returned kevent structures you can safely look at, if any.

Yes, I am ... but i'm going to take a longer look at this and figure out what i'm doing wrong. I appreciate the help, i'm just trying to understand this. I advocate Macs and OSX all the time to friends and coworkers, and I want to say things like "you can make an OSX server scale regarding simultaneous active socket connections as well, or better, than any Windows or Linux machine, and this is how 'cuz i've done it on all of them."


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com












_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: kevent and wait time?
      • From: email@hidden
References: 
 >kevent and wait time? (From: email@hidden)
 >Re: kevent and wait time? (From: Dave Zarzycki <email@hidden>)
 >Re: kevent and wait time? (From: email@hidden)
 >Re: kevent and wait time? (From: Dave Zarzycki <email@hidden>)
 >Re: kevent and wait time? (From: email@hidden)

  • Prev by Date: Re: kevent and wait time?
  • Next by Date: Re: kevent and wait time?
  • Previous by thread: Re: kevent and wait time?
  • Next by thread: Re: kevent and wait time?
  • Index(es):
    • Date
    • Thread