Skip to content

Commit

Permalink
renderer: keep patch_lock around and clear current_patch when stopped
Browse files Browse the repository at this point in the history
This commit makes renderer_lock_patch, renderer_unlock_patch, and
renderer_get_patch produce meaningful resuls also when the renderer
is not running.
  • Loading branch information
wpwrak committed Jan 30, 2012
1 parent b4458bc commit 23b34a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "yaffs.h"
#include "version.h"
#include "renderer/videoinreconf.h"
#include "renderer/renderer.h"
#include "shellext.h"
#include "sysconfig.h"
#include "fb.h"
Expand Down Expand Up @@ -95,6 +96,7 @@ static rtems_task gui_task(rtems_task_argument argument)
init_osc();
init_messagebox();
init_performance();
init_renderer();
init_cp();
init_keyboard();
init_ir();
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct patch *renderer_get_patch(int spin)
return current_patch;
}

void renderer_start(int framebuffer_fd, struct patch *p)
void init_renderer(void)
{
rtems_status_code sc;

Expand All @@ -156,7 +156,10 @@ void renderer_start(int framebuffer_fd, struct patch *p)
&patch_lock
);
assert(sc == RTEMS_SUCCESSFUL);
}

void renderer_start(int framebuffer_fd, struct patch *p)
{
assert(mashup_head == NULL);
mashup_head = patch_copy(p);
current_patch = mashup_head;
Expand Down Expand Up @@ -189,5 +192,5 @@ void renderer_stop(void)
patch_free(mashup_head);
mashup_head = p;
}
rtems_semaphore_delete(patch_lock);
current_patch = NULL;
}
1 change: 1 addition & 0 deletions src/renderer/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void renderer_add_patch(struct patch *p);
void renderer_del_patch(struct patch *p);
struct patch *renderer_get_patch(int spin);

void init_renderer(void);
void renderer_start(int framebuffer_fd, struct patch *p);
void renderer_stop(void);

Expand Down

0 comments on commit 23b34a3

Please sign in to comment.