summaryrefslogtreecommitdiff
path: root/gcell/src/lib/runtime/gc_job_manager_impl.cc
diff options
context:
space:
mode:
authoreb2008-04-16 03:48:33 +0000
committereb2008-04-16 03:48:33 +0000
commit8f2a5f3837da61a4d49251ee65f91f0d2e8e48de (patch)
tree750df8032c31b412a413ce749ec30d9363ac56f5 /gcell/src/lib/runtime/gc_job_manager_impl.cc
parent6d234892030754c0cd058ad85d2c3759b0538c90 (diff)
downloadgnuradio-8f2a5f3837da61a4d49251ee65f91f0d2e8e48de.tar.gz
gnuradio-8f2a5f3837da61a4d49251ee65f91f0d2e8e48de.tar.bz2
gnuradio-8f2a5f3837da61a4d49251ee65f91f0d2e8e48de.zip
Merged gcell-wip -r8159:8202 into trunk. This includes the following
changes: * gc_make_job_manager now returns a boost::shared_ptr * opts.program_handle is now a boost::shared_ptr * two new functions for getting a program handle * look_proc and alloc_job_desc now throw on error * static methods for setting and getting a single job manager * new exception hierarchy * mv gcell/src/lib/procs gcell/src/lib/wrapper * added libfft. Currently inverse xform is broken * gcell-embedspu-libtool creates libtool complaint .ko's from SPE executables git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8209 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gcell/src/lib/runtime/gc_job_manager_impl.cc')
-rw-r--r--gcell/src/lib/runtime/gc_job_manager_impl.cc29
1 files changed, 10 insertions, 19 deletions
diff --git a/gcell/src/lib/runtime/gc_job_manager_impl.cc b/gcell/src/lib/runtime/gc_job_manager_impl.cc
index dd08154d0..59deb4ae5 100644
--- a/gcell/src/lib/runtime/gc_job_manager_impl.cc
+++ b/gcell/src/lib/runtime/gc_job_manager_impl.cc
@@ -65,19 +65,6 @@ public:
}
};
-// custom deleter
-class spe_program_handle_deleter {
-public:
- void operator()(spe_program_handle_t *program) {
- if (program){
- int r = spe_image_close(program);
- if (r != 0){
- perror("spe_image_close");
- }
- }
- }
-};
-
// custom deleter of anything that can be freed with "free"
class free_deleter {
@@ -150,7 +137,7 @@ gc_job_manager_impl::gc_job_manager_impl(const gc_jm_options *options)
if (d_options.max_client_threads == 0)
d_options.max_client_threads = DEFAULT_MAX_CLIENT_THREADS;
- if (d_options.program_handle == 0){
+ if (!d_options.program_handle){
fprintf(stderr, "gc_job_manager: options->program_handle must be non-zero\n");
throw std::runtime_error("gc_job_manager: options->program_handle must be non-zero");
}
@@ -236,7 +223,7 @@ gc_job_manager_impl::gc_job_manager_impl(const gc_jm_options *options)
// get a handle to the spe program
- spe_program_handle_t *spe_image = d_options.program_handle;
+ spe_program_handle_t *spe_image = d_options.program_handle.get();
// fish proc_def table out of SPE ELF file
@@ -431,8 +418,12 @@ gc_job_manager_impl::bv_isclr(unsigned long *bv, unsigned int bitno)
gc_job_desc *
gc_job_manager_impl::alloc_job_desc()
{
- // stack is lock free, thus safe to call from any thread
- return gc_jd_stack_pop(d_free_list);
+ // stack is lock free, and safe to call from any thread
+ gc_job_desc *jd = gc_jd_stack_pop(d_free_list);
+ if (jd == 0)
+ throw gc_bad_alloc("alloc_job_desc: none available");
+
+ return jd;
}
void
@@ -557,7 +548,7 @@ bool
gc_job_manager_impl::wait_job(gc_job_desc *jd)
{
bool done;
- return wait_jobs(1, &jd, &done, GC_WAIT_ANY) == 1;
+ return wait_jobs(1, &jd, &done, GC_WAIT_ANY) == 1 && jd->status == JS_OK;
}
int
@@ -1246,7 +1237,7 @@ gc_job_manager_impl::lookup_proc(const std::string &proc_name)
if (proc_name == d_proc_def[i].name)
return i;
- return GCP_UNKNOWN_PROC;
+ throw gc_unknown_proc(proc_name);
}
std::vector<std::string>