projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
req input focus wdw be viewable
[goodguy/history.git]
/
cinelerra-5.1
/
cinelerra
/
forkbase.C
diff --git
a/cinelerra-5.1/cinelerra/forkbase.C
b/cinelerra-5.1/cinelerra/forkbase.C
index 174019ddd6c27f1d07c604b6c08200bfc8103650..5886424dd7dd1b1a7977b93530dab89fc9d30151 100644
(file)
--- a/
cinelerra-5.1/cinelerra/forkbase.C
+++ b/
cinelerra-5.1/cinelerra/forkbase.C
@@
-64,13
+64,6
@@
int ForkChild::is_running()
return !ppid || !kill(ppid, 0) ? 1 : 0;
}
return !ppid || !kill(ppid, 0) ? 1 : 0;
}
-int ForkChild::child_iteration()
-{
- int ret = read_child(100);
- if( ret <= 0 ) return ret;
- return handle_child();
-}
-
void ForkParent::start_child()
{
lock("ForkParent::new_child");
void ForkParent::start_child()
{
lock("ForkParent::new_child");
@@
-94,7
+87,7
@@
void ForkParent::start_child()
// Return -1 if the parent is dead
// Return 0 if timeout
// Return 1 if success
// Return -1 if the parent is dead
// Return 0 if timeout
// Return 1 if success
-int ForkBase::read_timeout(int
ms
, int fd, void *data, int bytes)
+int ForkBase::read_timeout(int
64_t usec
, int fd, void *data, int bytes)
{
fd_set rfds;
struct timeval timeout_struct;
{
fd_set rfds;
struct timeval timeout_struct;
@@
-102,8
+95,8
@@
int ForkBase::read_timeout(int ms, int fd, void *data, int bytes)
uint8_t *bp = (uint8_t *)data;
while( bytes_read < bytes ) {
uint8_t *bp = (uint8_t *)data;
while( bytes_read < bytes ) {
- timeout_struct.tv_sec =
ms / 1
000;
- timeout_struct.tv_usec =
(ms % 1000) * 1
000;
+ timeout_struct.tv_sec =
usec / 1000
000;
+ timeout_struct.tv_usec =
usec % 1000
000;
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
int result = select(fd+1, &rfds, 0, 0, &timeout_struct);
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
int result = select(fd+1, &rfds, 0, 0, &timeout_struct);
@@
-126,10
+119,10
@@
int ForkBase::is_running()
return !pid || !kill(pid, 0) ? 1 : 0;
}
return !pid || !kill(pid, 0) ? 1 : 0;
}
-int ForkBase::read_parent(int
ms
)
+int ForkBase::read_parent(int
64_t usec
)
{
token_bfr_t bfr;
{
token_bfr_t bfr;
- int ret = read_timeout(
ms
, parent_fd, &bfr, sizeof(bfr));
+ int ret = read_timeout(
usec
, parent_fd, &bfr, sizeof(bfr));
if( ret > 0 ) {
parent_token = bfr.token;
parent_bytes = bfr.bytes;
if( ret > 0 ) {
parent_token = bfr.token;
parent_bytes = bfr.bytes;
@@
-138,7
+131,7
@@
int ForkBase::read_parent(int ms)
parent_data = new uint8_t[parent_allocated = parent_bytes];
}
if( parent_bytes ) {
parent_data = new uint8_t[parent_allocated = parent_bytes];
}
if( parent_bytes ) {
- ret = read_timeout(1000, parent_fd, parent_data, parent_bytes);
+ ret = read_timeout(1000
000
, parent_fd, parent_data, parent_bytes);
if( !ret ) {
printf("read_parent timeout: %d\n", parent_fd);
ret = -1;
if( !ret ) {
printf("read_parent timeout: %d\n", parent_fd);
ret = -1;
@@
-148,10
+141,10
@@
int ForkBase::read_parent(int ms)
return ret;
}
return ret;
}
-int ForkBase::read_child(int
ms
)
+int ForkBase::read_child(int
64_t usec
)
{
token_bfr_t bfr;
{
token_bfr_t bfr;
- int ret = read_timeout(
ms
, child_fd, &bfr, sizeof(bfr));
+ int ret = read_timeout(
usec
, child_fd, &bfr, sizeof(bfr));
if( ret > 0 ) {
child_token = bfr.token;
child_bytes = bfr.bytes;
if( ret > 0 ) {
child_token = bfr.token;
child_bytes = bfr.bytes;
@@
-160,7
+153,7
@@
int ForkBase::read_child(int ms)
child_data = new uint8_t[child_allocated = child_bytes];
}
if( child_bytes ) {
child_data = new uint8_t[child_allocated = child_bytes];
}
if( child_bytes ) {
- ret = read_timeout(1000, child_fd, child_data, child_bytes);
+ ret = read_timeout(1000
000
, child_fd, child_data, child_bytes);
if( !ret ) {
printf("read_child timeout: %d\n", child_fd);
ret = -1;
if( !ret ) {
printf("read_child timeout: %d\n", child_fd);
ret = -1;
@@
-205,23
+198,17
@@
int ForkBase::send_child(int64_t token, const void *data, int bytes)
ForkChild::ForkChild()
{
ForkChild::ForkChild()
{
- done = 0;
+
parent_
done = 0;
}
ForkChild::~ForkChild()
{
}
}
ForkChild::~ForkChild()
{
}
-int ForkChild::handle_child()
-{
- printf("ForkChild::handle_child %d\n", __LINE__);
- return 0;
-}
-
ForkParent::ForkParent()
: Thread(1, 0, 0)
{
ForkParent::ForkParent()
: Thread(1, 0, 0)
{
- done = -1;
+
parent_
done = -1;
}
ForkParent::~ForkParent()
}
ForkParent::~ForkParent()
@@
-253,7
+240,7
@@
int ForkParent::handle_parent()
void ForkParent::start()
{
void ForkParent::start()
{
- done = 0;
+
parent_
done = 0;
Thread::start();
}
Thread::start();
}
@@
-270,7
+257,7
@@
void ForkParent::stop()
void ForkParent::run()
{
void ForkParent::run()
{
- while( !done && parent_iteration() >= 0 );
- done = 1;
+ while( !
parent_
done && parent_iteration() >= 0 );
+
parent_
done = 1;
}
}