Date: Wed, 10 Feb 2010 09:25:52 -0800 From: Randall Stewart <rrs@lakerest.net> To: Daniel Eischen <deischen@freebsd.org> Cc: threads@freebsd.org Subject: Re: Thinking about kqueue's and pthread_cond_wait Message-ID: <3CF3033E-FD13-405B-9DC6-DDE9DF4FBF37@lakerest.net> In-Reply-To: <Pine.GSO.4.64.1002101202060.13656@sea.ntplx.net> References: <3581A86D-9C9C-4E08-9AD3-CD550B180CED@lakerest.net> <Pine.GSO.4.64.1002101202060.13656@sea.ntplx.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 10, 2010, at 9:04 AM, Daniel Eischen wrote: > On Wed, 10 Feb 2010, Randall Stewart wrote: > >> All: >> >> I have once again come around to thinking about joining pthread >> cond waits and >> kqueue's. >> >> After thinking about it, I think its doable.. with something like a: >> >> pthread_cond_wait_kqueue_np(kev, cond, mtx, ucontext) >> >> Then you can use kev inside a kqueue i.e. >> ret = kevent(kq, kev, 1, outkev, 1, NULL); >> >> Now when you saw the event: >> if (kev.filter == EVFILT_UMTX){ /* not sure about the name here */ >> pthread_kqueue_cond_wait_ret_np(kev, cond, mtx, ucontext) >> do_user_action(cond,mtx, ucontext); >> } >> >> Which would fill in the cond/mtx and ucontext for the user. >> >> Now does this sound useful to anyone.. i.e. should I spend the time >> making it work? >> >> The only down side to this is that it would have to allocate memory >> so >> one would need to do a: >> >> pthread_kqueue_cond_wait_free_np(kev) >> >> After you were done.. and I think it would be best for this to >> be a ONE_SHOT.. i.e. you have to re-arm it if the event happens... >> Of course until you free it that can be as simple as passing the kev >> back down again (i.e. no pthread_cond_wait_kqueue_np() needed). >> >> Comments? Thoughts? i.e. especially is it worthwhile doing? > > Please don't mess with the pthread_ API like that :-) If you > really want to munge them together, see my email to you a few > weeks ago last time you brought it up.' If I remember right your email was basically don't do it... I will go dig through the archives and re-read it all. R > > -- > DE > ------------------------------ Randall Stewart 803-317-4952 (cell) 803-345-0391(direct)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CF3033E-FD13-405B-9DC6-DDE9DF4FBF37>