当前位置: 首页>>代码示例>>C++>>正文


C++ CreateMsgPort函数代码示例

本文整理汇总了C++中CreateMsgPort函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateMsgPort函数的具体用法?C++ CreateMsgPort怎么用?C++ CreateMsgPort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CreateMsgPort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: L_IPC_Startup

// Send an IPC startup
int ASM L_IPC_Startup(
	REG(a0, IPCData *ipc),
	REG(a1, APTR data),
	REG(a2, struct MsgPort *reply))
{
	struct MsgPort *port=0;
	IPCMessage startup;

	// If no message port supplied, create one
	if (!reply) port=reply=CreateMsgPort();

	// Fill out startup message
	startup.msg.mn_ReplyPort=reply;
	startup.command=IPC_STARTUP;
	startup.flags=(ULONG)ipc;
	startup.data=data;

	// Send the startup message
	PutMsg(&ipc->proc->pr_MsgPort,(struct Message *)&startup);

	// Wait for reply back
	WaitPort(reply);
	GetMsg(reply);

	// Delete port if we created one
	if (port) DeleteMsgPort(port);

	// If there's no command port, report failure
	if (startup.command!=IPC_STARTUP) return 0;
	return 1;
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:32,代码来源:ipc.c

示例2: IPC_StartupCode

IPC_StartupCode(funced_init, FunctionStartup *, startup)
#endif
{
	FuncEdData *data;

	// Allocate data
	if (!(data=AllocVec(sizeof(FuncEdData),MEMF_CLEAR)))
		return 0;

	// Store data
	startup->data=data;

	// Initialise some pointers
	data->startup=startup;
	data->function=startup->function;
	data->locale=startup->locale;

	// Create timer
	if (!(data->drag.timer=AllocTimer(UNIT_VBLANK,0)))
		return 0;

	// Create lists
	if (!(data->func_display_list=Att_NewList(0)) ||
		!(data->flag_list=Att_NewList(0)) ||
		!(data->function_list=Att_NewList(0)))
		return 0;

	// Create app port
	data->appport=CreateMsgPort();
	return 1;
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:31,代码来源:function_editor.c

示例3: AllocRocket

struct NepClassRocket * AllocRocket(struct NepClassRocket *nch)
{
    nch->nch_Task = FindTask(NULL);

    if((nch->nch_TaskMsgPort = CreateMsgPort()))
    {
        nch->nch_IF0 = psdFindInterface(nch->nch_Device, NULL,
                                        IFA_InterfaceNum, 0,
                                        TAG_END);
        nch->nch_IF1 = psdFindInterface(nch->nch_Device, NULL,
                                        IFA_InterfaceNum, 1,
                                        TAG_END);
        if(nch->nch_IF0 && nch->nch_IF1)
        {
            if((nch->nch_EP0Pipe = psdAllocPipe(nch->nch_Device, nch->nch_TaskMsgPort, NULL)))
            {
                return(nch);
            } else {
                PutStr("Couldn't allocate default pipe\n");
            }
        } else {
            PutStr("Couldn't find interfaces\n");
        }
        DeleteMsgPort(nch->nch_TaskMsgPort);
    }
    return(NULL);
}
开发者ID:michalsc,项目名称:AROS,代码行数:27,代码来源:RocketTool.c

示例4: dllKillLibrary

int dllKillLibrary(char *portname)
{
    dll_tMessage msg,*reply;
    struct MsgPort *myport;
    struct MsgPort *dllport;

    bug("[DynLink] %s('%s')\n", __PRETTY_FUNCTION__, portname);

    if(!(myport=CreateMsgPort()))
        exit(0L);       //Arghh
    
    bzero(&msg, sizeof(msg));

    msg.dllMessageType=DLLMTYPE_Kill;

    msg.Message.mn_ReplyPort = myport;

    if((dllport=FindPort(portname)))
    {
        PutMsg(dllport, (struct Message *)&msg);
        /*WaitPort(myport);*/
        while(!(reply=(dll_tMessage *)GetMsg(myport)))
        {
            Delay(2);
            if(FindPort(portname)!=dllport)
                break;
        }
    }

    DeleteMsgPort(myport);

    return (dllport?1:0);
}
开发者ID:DanielGibson,项目名称:dhewm3,代码行数:33,代码来源:dll.c

示例5: Audio_Available

static int Audio_Available(void)
{
	int ok=0;
	struct MsgPort *p;
	struct AHIRequest *req;

	if(p=CreateMsgPort())
	{
		if(req=(struct AHIRequest *)CreateIORequest(p,sizeof(struct AHIRequest)))
		{
			req->ahir_Version=4;

			if(!OpenDevice(AHINAME,0,(struct IORequest *)req,NULL))
			{
				D(bug("AHI available.\n"));
				ok=1;
				CloseDevice((struct IORequest *)req);
			}
			DeleteIORequest((struct IORequest *)req);
		}
		DeleteMsgPort(p);
	}

	D(if(!ok) bug("AHI not available\n"));
	return ok;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:26,代码来源:SDL_ahiaudio.c

示例6: Initialize

BOOL Initialize(void) {
  LocaleBase = OpenLibrary("locale.library", 38);

  OpenahiprefsCatalog();

  AHImp=CreateMsgPort();

  if( AHImp != NULL ) {
    AHIio = (struct AHIRequest *)CreateIORequest(
        AHImp,sizeof(struct AHIRequest));

    if( AHIio != NULL ) {
      AHIio->ahir_Version = 4;
      AHIDevice = OpenDevice(AHINAME,AHI_NO_UNIT,(struct IORequest *)AHIio,NULL);
      if(AHIDevice == 0) {
        AHIBase   = (struct Library *)AHIio->ahir_Std.io_Device;
        return TRUE;
      }
    }
  }

  Printf((char *) msgTextNoOpen, (ULONG) "ahi.device", 4);
  Printf("\n");
  return FALSE;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:25,代码来源:support.c

示例7: uae_start_thread

int uae_start_thread (void *(*f) (void *), void *arg, uae_thread_id *foo)
{
    struct MsgPort *replyport = CreateMsgPort();

    if (replyport) {
	*foo = (struct Task *)myCreateNewProcTags (NP_Output,		   Output (),
						   NP_Input,		   Input (),
						   NP_Name,	   (ULONG) "UAE thread",
						   NP_CloseOutput,	   FALSE,
						   NP_CloseInput,	   FALSE,
						   NP_StackSize,	   16384,
						   NP_Entry,	   (ULONG) do_thread,
						   TAG_DONE);

	if(*foo) {
	    struct startupmsg msg;

	    msg.msg.mn_ReplyPort = replyport;
	    msg.msg.mn_Length    = sizeof msg;
	    msg.func             = f;
	    msg.arg              = arg;
	    PutMsg (&((struct Process*)*foo)->pr_MsgPort, (struct Message*)&msg);
	    WaitPort (replyport);
	}
	DeleteMsgPort (replyport);
    }

    return *foo!=0;
}
开发者ID:CrashSerious,项目名称:PiUAE,代码行数:29,代码来源:thread.c

示例8: start_proxy_thread

/*
 * Start proxy thread
 */
static int start_proxy_thread (void)
{
    int result = -1;
    struct MsgPort *replyport = CreateMsgPort();
    struct Process *p;

    if (replyport) {
	p = myCreateNewProcTags (NP_Name,	(ULONG) "E-UAE semaphore proxy",
				 NP_Priority,		10,
				 NP_StackSize,		2048,
				 NP_Entry,	(ULONG) proxy_thread_main,
				 TAG_DONE);
	if (p) {
	    /* Send startup message */
	    struct Message msg;
	    msg.mn_ReplyPort = replyport;
	    msg.mn_Length    = sizeof msg;
	    PutMsg (&p->pr_MsgPort, (struct Message*)&msg);
	    WaitPort (replyport);

	    proxy_thread = p;

	    atexit (stop_proxy_thread);

	    result = 0;
	}
	DeleteMsgPort (replyport);
    }
    return result;
}
开发者ID:CrashSerious,项目名称:PiUAE,代码行数:33,代码来源:thread.c

示例9: openLibrariesAndPorts

void openLibrariesAndPorts(void) {
  if(!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",
                                                           MINOSVERSION))) {
    cleanup(EXIT_ERROR,"Can't open intuition.library.");
  }
  if(!(RexxSysBase = (struct RsxLib *)OpenLibrary("rexxsyslib.library",0L))) {
    cleanup(EXIT_ERROR,"Can't open rexxsyslib.library.");
  }
  if(!(UtilityBase = OpenLibrary("utility.library", MINOSVERSION))) {
    cleanup(EXIT_ERROR,"Can't open utility.library.");
  }
  if(!(NiKomBase = OpenLibrary("nikom.library", NIKLIBVERSION))) {
    cleanup(EXIT_ERROR, "Can't open nikom.library v" NIKLIBVERSIONSTR " or later.");
  }
  if(!(permitport = (struct MsgPort *)CreatePort("NiKomPermit",0))) {
    cleanup(EXIT_ERROR,"Can't open port 'NiKomPermit'");
  }
  if(!(nodereplyport = CreateMsgPort())) {
    cleanup(EXIT_ERROR,"Can't open node reply message port.");
  }

  if(!(rexxport=(struct MsgPort *)CreatePort("NIKOMREXXHOST",0))) {
    cleanup(EXIT_ERROR, "Could not open ARexx function host port.");
  }
  RegisterARexxFunctionHost(TRUE);
}
开发者ID:punktniklas,项目名称:NiKom,代码行数:26,代码来源:Startup.c

示例10: main

int
main(int argc, char* argv[]) {
  int rc = RETURN_OK;

  if (argc != 2) {
    fprintf(stderr, "Usage: %s <audio mode id>\n", argv[0]);
    rc = RETURN_ERROR;
  }
  else {
    struct MsgPort* mp = CreateMsgPort();

    if (mp != NULL) {
      struct AHIRequest* io = (struct AHIRequest *)
	CreateIORequest(mp, sizeof(struct AHIRequest));

      if (io != NULL) {
	io->ahir_Version = 4;

	if (OpenDevice(AHINAME, AHI_NO_UNIT, (struct IORequest *) io, 0) == 0) {
	  AHIBase = (struct Library *) io->ahir_Std.io_Device;

	  BetterAudioID = atol(argv[1]);

	  Forbid();
	  OldBestAudioIDA = (BestAudioIDA_proto*) 
	    SetFunction(AHIBase, _LVOAHI_BestAudioIDA,
			(ULONG (*)(void)) MyBestAudioIDA );

	  Wait(SIGBREAKF_CTRL_C);

	  SetFunction(AHIBase, _LVOAHI_BestAudioIDA,
		      (ULONG (*)(void)) OldBestAudioIDA );
	  rc = 0;

	  Permit();

	  CloseDevice((struct IORequest *) io);
	}
	else {
	  fprintf(stderr, "Unable to open '" AHINAME "' version 4.\n");
	  rc = RETURN_FAIL;
	}
	
	DeleteIORequest((struct IORequest *) io);
      }
      else {
	fprintf(stderr, "Unable to create IO request.\n");
	rc = RETURN_FAIL;
      }

      DeleteMsgPort(mp);
    }
    else {
      fprintf(stderr, "Unable to create message port.\n");
      rc = RETURN_FAIL;
    }
  }
  
  return rc;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:60,代码来源:BetterAudioID.c

示例11: OpenAHI

void
OpenAHI( void )
{
  if( AHIDevice != 0 )
  {
    AHImp = CreateMsgPort();

    if( AHImp != NULL )
    {
      AHIio = (struct AHIRequest *)
                  CreateIORequest( AHImp, sizeof( struct AHIRequest ) );

      if( AHIio != NULL )
      {
        AHIio->ahir_Version = AHIVERSION;

        AHIDevice = OpenDevice( AHINAME, 
                                AHI_NO_UNIT,
                                (struct IORequest *) AHIio,
                                AHIDF_NOMODESCAN );
      }
    }

    if( AHIDevice != 0 )
    {
      Printf( "Unable to open %s version %ld\n", (ULONG) AHINAME, AHIVERSION );
      cleanup( RETURN_FAIL );
    }

    AHIBase = (struct Library *) AHIio->ahir_Std.io_Device;
  }
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:32,代码来源:AddAudioModes.c

示例12: AllocVec

struct SysThread *Sys_Thread_CreateThread(void (*entrypoint)(void *), void *argument)
{
	struct SysThread *thread;

	thread = AllocVec(sizeof(*thread), MEMF_ANY);
	if (thread)
	{
		thread->msgport = CreateMsgPort();
		if (thread->msgport)
		{
			thread->msg.mn_Node.ln_Type = NT_MESSAGE;
			thread->msg.mn_ReplyPort = thread->msgport;
			thread->msg.mn_Length = sizeof(thread->msg);

			thread->entrypoint = entrypoint;
			thread->argument = argument;

			thread->process = CreateNewProcTags(NP_Entry, Sys_Thread_Trampoline,
			                                    NP_UserData, thread,
			                                    NP_Name, "Fodquake Thread",
			                                    NP_StackSize, 32768,
			                                    TAG_DONE);
			if (thread->process)
			{
				return thread;
			}

			DeleteMsgPort(thread->msgport);
		}
		FreeVec(thread);
	}

	return 0;
}
开发者ID:classicQ,项目名称:classicQ.github.io,代码行数:34,代码来源:thread_aros.c

示例13: urndis_ctrl_msg

uint32_t urndis_ctrl_msg(struct NepClassEth *ncp, uint8_t rt, uint8_t r,
    uint16_t index, uint16_t value, void *buf, size_t buflen)
{

    LONG err=-1;
    struct PsdPipe *pp;
    struct MsgPort *mp;

    if((mp = CreateMsgPort()))
    {
        if((pp = psdAllocPipe(ncp->ncp_Device, mp, NULL)))
        {

            psdSetAttrs(PGA_PIPE, pp,
                PPA_NakTimeout, FALSE,
                PPA_NakTimeoutTime, 5000,
                PPA_AllowRuntPackets, TRUE,
                TAG_END);

           // bug("urndis_ctrl_msg:pipesetup( %d,%d,%d,%d,%d )\n",pp, rt, r, value, index);
            psdPipeSetup(pp, rt, r, value, index);
           // bug("urndis_ctrl_msg:psdDoPipe(%d,%d,%d)\n",pp, buf, buflen);
            err = psdDoPipe(pp, buf, buflen);
            if(err!=0){
                bug("urndis_ctrl_msg:error %d,%s\n",err,psdNumToStr(NTS_IOERR, err, "unknown"));
            }
            psdFreePipe(pp);
        }
        DeleteMsgPort(mp);
    }

    return err;
}
开发者ID:michalsc,项目名称:AROS,代码行数:33,代码来源:if_urndis.c

示例14: PingFunc

VOID __saveds PingFunc( VOID )
{
    struct MsgPort *ClientPort, *ReplyPort;
	struct Library *SysBase;
    BlankMsg PingMsg;

	SysBase = *( struct Library ** )4L;

	if( ReplyPort = CreateMsgPort())
	{
		PingMsg.bm_Mess.mn_ReplyPort = ReplyPort;
		PingMsg.bm_Mess.mn_Length = sizeof( BlankMsg );
		PingMsg.bm_Type = BM_PING;
		/* Stealthimania, to alleviate processing at the blanker */
		PingMsg.bm_Mess.mn_Node.ln_Name = ( UBYTE * )( &Blanking );

		for( ;; )
		{
			if( SetSignal( 0L, SIGBREAKF_CTRL_C ) & SIGBREAKF_CTRL_C )
				break;

			if( ClientPort = FindPort( "GarshneClient" ))
			{
				PingMsg.bm_Flags = 0L;
				PutMsg( ClientPort, ( struct Message * )( &PingMsg ));
				WaitPort( ReplyPort );
				GetMsg( ReplyPort );
			}
		}
		DeletePort( ReplyPort );
	}
}
开发者ID:samskivert,项目名称:garshneblanker,代码行数:32,代码来源:module.c

示例15: NetworkCoreInitialize

/**
 * Initializes the network core (as that is needed for some platforms
 * @return true if the core has been initialized, false otherwise
 */
bool NetworkCoreInitialize()
{
#if defined(__MORPHOS__) || defined(__AMIGA__)
	/*
	 *  IMPORTANT NOTE: SocketBase needs to be initialized before we use _any_
	 *  network related function, else: crash.
	 */
	DEBUG(net, 3, "[core] loading bsd socket library");
	SocketBase = OpenLibrary("bsdsocket.library", 4);
	if (SocketBase == NULL) {
		DEBUG(net, 0, "[core] can't open bsdsocket.library version 4, network unavailable");
		return false;
	}

#if defined(__AMIGA__)
	/* for usleep() implementation (only required for legacy AmigaOS builds) */
	TimerPort = CreateMsgPort();
	if (TimerPort != NULL) {
		TimerRequest = (struct timerequest*)CreateIORequest(TimerPort, sizeof(struct timerequest);
		if (TimerRequest != NULL) {
			if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest*)TimerRequest, 0) == 0) {
				TimerBase = TimerRequest->tr_node.io_Device;
				if (TimerBase == NULL) {
					/* free ressources... */
					DEBUG(net, 0, "[core] can't initialize timer, network unavailable");
					return false;
				}
			}
		}
	}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:34,代码来源:core.cpp


注:本文中的CreateMsgPort函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。