aboutsummaryrefslogblamecommitdiff
path: root/event.go
blob: 63239070f6b8cd5c5ceae4b260490e1993748949 (plain) (tree)
1
2
3
4
5
6
7
8
9
10




                                
                
 
                                                 

                                      

                                        
 
 
                                


                                     





                                                                          


                                                                                                

                                                                                                    



                                                                              
                                                                           




                                                                               
                                                                   
 
                                              
                                  

                                           

                                                                     
                             
 

                                                                         

                                                 


                                                                           
                                                


                                                                        
 
 
                                                               
 
                                                               
                                                                                  
                                                               

 
                                            

                               

                          
 

                                
                             
 
                                                                       
                                                                           

                                              

                                                                        
                                                                                           






                                                                        

 
                                                            

                       
                                                                                    
                                                              

 
                                                    
                                                                                        
 

                                                                                 
                              

                                            

 

                                                                          
                                

                                            

 
                                     

                           

                          
 

                                      
                         
 
                                          
 
     

                           

 

                                                                      
                                                                                     






                                                                      

 
                                                        

                                                     
                                                                         
 
                                                                        
                            

                                            

 

                                                                            
                              

                                            
 



                                             

                          












                                                                              


                                                                       





                                                                                                   


                                                                          



                                      

                                             





                                                                            
                                                                             




                                                                           
                                                              




                                                                               
                                                                
 
package salticidae

// #include "salticidae/event.h"
// #include <signal.h>
import "C"
import "runtime"

// The C pointer type for an EventContext handle.
type CEventContext = *C.eventcontext_t
type eventContext struct {
	inner    CEventContext
	attached map[uintptr]interface{}
}

// The handle for an event loop.
type EventContext = *eventContext

func NewEventContext() EventContext {
	res := &eventContext{
		inner:    C.eventcontext_new(),
		attached: make(map[uintptr]interface{}),
	}
	runtime.SetFinalizer(res, func(self EventContext) { self.free() })
	return res
}

func (self EventContext) attach</