If you have a specific case that isn't covered by blocking in a go-routine, 
you can always use the syscall's directly, with a very similar API to what 
you would do in C. 

For example here's the epoll ones in stdlib: 
https://golang.org/pkg/syscall/#EpollCreate

New syscall wrappers are in the x/sys repo: 
https://godoc.org/golang.org/x/sys/unix

On Thursday, 22 September 2011 07:04:03 UTC-7, vase wrote:
>
>
>
> 2011/9/22 André Moraes <and...@gmail.com <javascript:>>
>
>> In most cases you should not need to poll explicity.
>> Write a goroutine that blocks while reading the contents of your fd
>> (file, network, etc...), and then send the data read across a channel.
>>
>> Under the hood Go will take care of the poll for you.
>>
>> But if you really need to poll explicitly, I can't help you since I
>> never had to do that.
>>
>
> Hm... Can somebody from golang team tell me, what is the best way to 
> provide this (example written in C):
> xs_watch() // create a hook, that watch to specific path to cheange
> epoll_wait() //wait to event on fd that returned by watch
> xs_read_watch() //read watched data that appeared
> xs_unwatch() //delete watch and stops recive notify
>
> As i see, i need to create goroutine in xs_watch(worker), that runs worker 
> function with read, then some data appeared, goroutine read and do some 
> stuff, xs_unwatch destroy groutine and stops watching... Right? 
>
>
>
> -- 
> Vasiliy Tolstov,
> Clodo.ru
> e-mail: v.to...@selfip.ru <javascript:>
> jabber: va...@selfip.ru <javascript:>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to