Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
115 user(s) are online (107 user(s) are browsing Forums)

Members: 1
Guests: 114

Raziel, more...

Support us!

Headlines

 
  Register To Post  

CreateMsgPort is deprecated?
Home away from home
Home away from home


See User information
I'm getting this warning while compiling my software. This function is deprecated. What am i supposed to replace it with???

X5000
Go to top
Re: CreateMsgPort is deprecated?
Supreme Council
Supreme Council


See User information
AllocSysObjectTags( ASOT_PORT, tags...);

Check exec/exectags.h for tags to accompany it.

And use FreeSysObject() rather than DeleteMsgPort().

Simon

Comments made in any post are personal opinion, and are in no-way representative of any commercial entity unless specifically stated as such.
----
http://codebench.co.uk
Go to top
Re: CreateMsgPort is deprecated?
Amigans Defender
Amigans Defender


See User information
@Antique

You'll usually be fine with:

struct MsgPort *myPort NULL;

myPort = (struct MsgPort *)IExec->AllocSysObject(ASOT_PORTNULL);

The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Go to top
Re: CreateMsgPort is deprecated?
Home away from home
Home away from home


See User information
Thanks guys.

X5000
Go to top
Re: CreateMsgPort is deprecated?
Just can't stay away
Just can't stay away


See User information
@Antique

so, what way did you choose? the Rigo's way or trixie's way?

I am asking it as I am a newbie developer and I am just learning Reaction starting from the example and tutorial in the AmigaWiki Page..

Go to top
Re: CreateMsgPort is deprecated?
Amigans Defender
Amigans Defender


See User information
@nubechecorre

It's the same way. My example uses no tags because that's what most port allocations are fine with. For example, if you just need to allocate a message port for the ReAction window.class, IExec->AllocSysObject(ASOT_PORT, NULL) is perfectly sufficient, as you can see in one of my tutorials over at OS4depot.net.

Rigo's example uses the same function call but with tags. You'd use tags, for example, if you needed a named message port. In this case you'd do something like

(Edited accordingly, based on Thomas' post below)
IExec->AllocSysObjectTags(ASOT_PORT, ASOPORT_Name, "MyNamedPort", TAG_DONE);

And... don't forget to call IExec->FreeSysObject() when you no longer need the port!


Edited by trixie on 2013/2/26 17:21:51
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Go to top
Re: CreateMsgPort is deprecated?
Not too shy to talk
Not too shy to talk


See User information
Quote:
IExec->AllocSysObject(ASOT_PORT, ASOPORT_Name, "MyNamedPort", TAG_DONE);


This should read IExec->AllocSysObjectTags(ASOT_PORT, ASOPORT_Name, "MyNamedPort", TAG_DONE);

Otherwise it won't compile.

AllocSysObject takes a pointer to an array of struct TagItem, AllocSysObjectTags takes the tag items as varargs.




Go to top
Re: CreateMsgPort is deprecated?
Amigans Defender
Amigans Defender


See User information
@thomas

Of course! Sorry - a silly copy-and-paste mistake. Thank you for the correction, I'll edit the original post accordingly.

The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Go to top
Re: CreateMsgPort is deprecated?
Quite a regular
Quite a regular


See User information
Another frequent use of the tags is when you want to use a structure that starts with a MsgPort, but all the rest of it is private stuff.
eg:
struct PostOffice
{
struct MsgPort;
APTR ---
---
---
};

You can allocate such a structure as a MsgPort of a larger size, using the tag
"ASOPORT_Size, sizeof (struct PostOffice)". You will then get a clean, initialised MsgPort and all the space after it that you need. You can simply FreeSysObject (ASOT_PORT, xxx) when you're finished with it.

cheers
tony
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project