Re: eventfd lookalike in FreeBSD ?

2015-07-29 Thread Edward Tomasz NapieraƂa
On 0728T1419, Luigi Rizzo wrote:
> Hi,
> for some work we are doing on bhyve, we need some lightweight mechanism that
> a kernel thread can use to wake up another user thread possibly
> waiting for some event.

https://reviews.freebsd.org/D2172

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: eventfd lookalike in FreeBSD ?

2015-07-28 Thread Adrian Chadd
On 28 July 2015 at 10:42, David Chisnall  wrote:
> On 28 Jul 2015, at 18:33, Adrian Chadd  wrote:
>>
>> Windows has had this for years. It makes async network programming
>> with thread worker queues significantly less abusive.
>
> Can you do the same with Solaris completion ports?  It might be a good source 
> of inspiration for a good API if so.

I don't think you can do it with the solaris event ports. I don't know
about their more later stuff.


-a
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: eventfd lookalike in FreeBSD ?

2015-07-28 Thread David Chisnall
On 28 Jul 2015, at 18:33, Adrian Chadd  wrote:
> 
> Windows has had this for years. It makes async network programming
> with thread worker queues significantly less abusive.

Can you do the same with Solaris completion ports?  It might be a good source 
of inspiration for a good API if so.

David

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: eventfd lookalike in FreeBSD ?

2015-07-28 Thread Adrian Chadd
On 28 July 2015 at 10:31, David Chisnall  wrote:
> On 28 Jul 2015, at 18:23, Adrian Chadd  wrote:
>>
>> (What would be nice is having kqueue know about conditionals, so we
>> can sleep on a cond as well as a kqueue fd+queue, but I can't have
>> everything I want..)
>
> I recently came across a need to do something like this.  Being able to add 
> condvar / mutex pairs to a kqueue and wait on a set of condition variables, 
> reacquiring the mutexes for any of the signalled ones, as well as waiting for 
> kernel events would be very useful.

Windows has had this for years. It makes async network programming
with thread worker queues significantly less abusive.


-adrian
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: eventfd lookalike in FreeBSD ?

2015-07-28 Thread David Chisnall
On 28 Jul 2015, at 18:23, Adrian Chadd  wrote:
> 
> (What would be nice is having kqueue know about conditionals, so we
> can sleep on a cond as well as a kqueue fd+queue, but I can't have
> everything I want..)

I recently came across a need to do something like this.  Being able to add 
condvar / mutex pairs to a kqueue and wait on a set of condition variables, 
reacquiring the mutexes for any of the signalled ones, as well as waiting for 
kernel events would be very useful.

David

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: eventfd lookalike in FreeBSD ?

2015-07-28 Thread Adrian Chadd
There's a kqueue notification mechanism just for this very thing.

(What would be nice is having kqueue know about conditionals, so we
can sleep on a cond as well as a kqueue fd+queue, but I can't have
everything I want..)



-adrian


On 28 July 2015 at 05:19, Luigi Rizzo  wrote:
> Hi,
> for some work we are doing on bhyve, we need some lightweight mechanism that
> a kernel thread can use to wake up another user thread possibly
> waiting for some event.
>
> If the recipient of the event were a kernel thread it would simply
> do a tsleep(chan...) and the sender would do a wakeup() or wakeup_one().
>
> Do we have an equally simple option for a recipient that is a
> userspace thread using something that is already in the kernel ?
> Do we have some blocking syscall that ends up doing a tsleep in
> a predictable way ?
>
> I suppose I could create a kqueue() descriptor and instruct the kernel
> thread side to post an event instead of doing the wakeup, but
> this seems a bit more expensive on both endpoints.
>
> cheers
> luigi
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"