Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
20 user(s) are online (9 user(s) are browsing Forums)

Members: 0
Guests: 20

more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: SMTube : new version on OS4Depot

Subject: Re: SMTube : new version on OS4Depot
by LiveForIt on 2014/6/2 12:06:36

@zzd10h

Quote:
Unfortunately, on AmigaOS, a new SMTube instance will be started for each "-url xxx" request.


This can be solved by creating a Amiga MsgPort.

If port found send the URL to running SMTube and quit, if port not found run application like you normally do.


Struct MsgPort *smport;

BOOL msgport_startup()
{
    
Forbid();
    
smport FindPort(“smtube”);
    
Permit();

    if (
smport == NULL)
    {
        
smport AllocSysObject(ASOT_PORT ASOPORT_Name“smtube”TAG_END);
        Return 
True;
    }
    else
    {
        Return 
False;
    }
}

void msgport_shutdown()
{
    if (
smportFreeSysObject(smport);
    
smport NULL;
}

void send_msg(char *value)
{
    
struct smtube_msg *msg;

    if (
msg AllocSysObject(ASOT_MESSAGEASOMSG_Sizesizeof(struct smtube_msg) ,TAG_END))
    {
        
msg -> opt strdup(-url”);
        
msg -> value strdup(value);
        
PutMsg(smport,msg);
    }
}

void get_msg()
{
    
struct smtube_msg *msg;

    while (
msg GetMsg(smport))
    {
        
// 1. DO SOME THING
        // 2. Then clean up.
        
free(msg -> opt);
        
free(msg -> value);
        
ReplyMsg(msg);
    }
}

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project