+// the benchmark controller
+
+package benchcontroller
+
+import (
+ //"./dbconnector";
+ "os";
+ "time";
+)
+
+type BenchControllerConfig struct {
+ id int;
+}
+
+func CreateController()(contConfig *BenchControllerConfig)
+{
+ bcConfig := new(BenchControllerConfig);
+
+ return bcConfig;
+}
+
+func MainLoop(conf *BenchControllerConfig, commInChan chan int, commOutChan chan int)
+{
+ for {
+ time.Sleep(1000000000);
+ i := <-commInChan;
+ os.Stdout.WriteString("got a coms\n");
+ commOutChan <- i;
+ os.Stdout.WriteString("Send some back\n");
+ }
+}
\ No newline at end of file
#cp dbibridge.a /export/src/external/golang//pkg/linux_386/dbibridge.a
gcc -m32 -fPIC -O2 -o dbibridge.cgo4.o -c dbibridge.cgo4.c
gcc -m32 -shared -L`pwd` -lpthread -lm -ldbi -o dbibridge_dbibridge.so dbibridge.cgo4.o
-#cp dbibridge.so /export/src/external/golang//pkg/linux_386/./dbibridge_dbibridge.so
+cp dbibridge_dbibridge.so /export/src/external/golang//pkg/linux_386/./dbibridge_dbibridge.so
+
+8g benchcontroller.go
import (
"http";
"io";
- "./dbibridge";
+ //"./dbibridge";
+ "./benchcontroller";
+ "fmt";
)
+var comin chan int;
+var comout chan int;
+
// hello world, the web server
func HelloServer(c *http.Conn, req *http.Request) {
+ comout <- 1;
io.WriteString(c, "<html><form method=post><input type=\"input\"><input type=\"submit\" name=\"go\" value=\"go\"></html>\n");
+
+ // fucking go, i just wanna consume the incoming data, but it forces me to do something with it... cunt of a language
+ k := <- comin;
+ fmt.Printf("%d\n", k);
}
func main() {
- var Dbconn *dbibridge.DBIConnection;
+ //var Dbconn *dbibridge.DBIConnection;
+
+ //Dbconn = dbibridge.DBICreate();
+
+ //dbibridge.DBIConnect(Dbconn, "mysql", "localhost", "root", "password", "zm");
+ //dbibridge.ExecSQL(Dbconn, "create table asdf (asdf int)");
+ //dbibridge.DBIDisconnect(Dbconn);
+
+ comin = make(chan int);
+ comout = make(chan int);
- Dbconn = dbibridge.DBICreate();
+ bc := benchcontroller.CreateController();
+ go benchcontroller.MainLoop(bc, comout, comin);
- dbibridge.DBIConnect(Dbconn, "mysql", "localhost", "root", "password", "zm");
- dbibridge.ExecSQL(Dbconn, "create table asdf (asdf int)");
- dbibridge.DBIDisconnect(Dbconn);
- //http.Handle("/hello", http.HandlerFunc(HelloServer));
- //err := http.ListenAndServe(":12345", nil);
- //if err != nil {
- ////panic("ListenAndServe: ", err.String())
- //}
+ http.Handle("/hello", http.HandlerFunc(HelloServer));
+ err := http.ListenAndServe(":12345", nil);
+ if err != nil {
+ panic("ListenAndServe: ", err.String())
+ }
}