]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
Added partial implementation for executor
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 25 Sep 2008 16:53:49 +0000 (18:53 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 25 Sep 2008 16:53:49 +0000 (18:53 +0200)
This should be the way, how to specify which thread will handle
requests to which object.

Makefile.omk
executor.c [new file with mode: 0644]
executor.h [new file with mode: 0644]

index 263a76c5e7e9a70a4753d1191bdf92416774fd26..28ed8a135ab76b625515db7a2922b3a679da4b5c 100644 (file)
@@ -4,7 +4,8 @@ EXTRA_RULES_SUBDIRS = forb-idl
 IDL_COMPILER += --pidl
 
 lib_LIBRARIES += forb
-forb_SOURCES = forb.c cdr.c sha1.c uuid.c iop.c proto.c syncobj.c request.c
+forb_SOURCES = forb.c cdr.c sha1.c uuid.c iop.c proto.c syncobj.c      \
+              request.c executor.c
 forb_CLIENT_IDL = types.idl iop-idl.idl
 
 to_forb_subdir=$(1)->forb/$(strip $(1))
@@ -23,6 +24,7 @@ renamed_include_HEADERS += \
        $(call to_forb_subdir, uuid.h) \
        $(call to_forb_subdir, syncobj.h) \
        $(call to_forb_subdir, request.h) \
+       $(call to_forb_subdir, executor.h) \
        $(call to_forb_subdir, proto.h)
 
 renamed_include_GEN_HEADERS = \
diff --git a/executor.c b/executor.c
new file mode 100644 (file)
index 0000000..82d09f4
--- /dev/null
@@ -0,0 +1,44 @@
+#include <forb/executor.h>
+
+int forb_executor_init(forb_executor_t *executor)
+{
+       return -1;
+}
+void forb_executor_destroy(forb_executor_t *executor)
+{
+}
+
+int forb_executor_register_object(forb_executor_t *executor, forb_object obj)
+{
+       return -1;
+}
+
+int forb_executor_run(forb_executor_t *executor)
+{
+       return -1;
+}
+
+/** 
+ * Convenience function for executing only one object in one executor.
+ * 
+ * @param obj The object to execute.
+ * 
+ * @return Zero in case of success, error code on error.
+ */
+int forb_execute_object(forb_object obj)
+{
+       forb_executor_t executor;
+       int ret;
+       
+       ret = forb_executor_init(&executor);
+       if (ret) goto error;
+       ret = forb_executor_register_object(&executor, obj);
+       if (ret) goto destroy_and_error;
+       
+       ret = forb_executor_run(&executor);
+
+destroy_and_error:
+       forb_executor_destroy(&executor);
+error:
+       return ret;
+}
diff --git a/executor.h b/executor.h
new file mode 100644 (file)
index 0000000..59a0c8e
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef EXECUTOR_H
+#define EXECUTOR_H
+
+#include <forb/forb.h>
+
+typedef struct forb_executor {
+       int dummy;
+} forb_executor_t;
+
+int forb_executor_init(forb_executor_t *executor);
+void forb_executor_destroy(forb_executor_t *executor);
+int forb_executor_register_object(forb_executor_t *executor, forb_object obj);
+int forb_executor_run(forb_executor_t *executor);
+
+int forb_execute_object(forb_object obj);
+
+
+#endif