On Tue, Dec 23, 2014 at 05:43:41PM +0100, Huy Cong Vu wrote:
> 
> 
> ----- Mail original -----
> > De: "Gilles Chanteperdrix" <[email protected]>
> > À: "Huy Cong Vu" <[email protected]>
> > Cc: [email protected]
> > Envoyé: Mardi 23 Décembre 2014 17:35:35
> > Objet: Re: [Xenomai] Differents switch mode from differents Xenomai skin
> 
> > On Tue, Dec 23, 2014 at 05:23:07PM +0100, Huy Cong Vu wrote:
> >> void mini( void *ptr )
> >> {
> >> 
> >> 
> >>    uint8_t b;
> >>    int ret1;
> >>    int idx;
> >> 
> >>    pthread_set_mode_np(0, PTHREAD_WARNSW);
> >>    printf("Starting posix test\n");
> >> 
> >>    ec_port = malloc(sizeof(ecx_portt*));
> >> 
> >>    if (setup_nic(ec_port,"rteth0") > 0) {
> >>               idx = getindex (ec_port);
> >>                    /* setup datagram */
> >>                    b = 0x0000;
> >>                    setupdatagram (ec_port, &(ec_port->txbuf[idx]),0x0009, 
> >> idx, 0x0000, 0x0103,
> >>                    sizeof(b), &b );
> >>                    /* send data and wait for answer */
> >>                    wkc = srconfirm (ec_port, idx, EC_TIMEOUTRET3);
> >>    }
> >>    
> >> }
> > 
> > Typically, as I already explained, what you do here is wrong: you
> > should not arm the PTHREAD_WARNSW bit before call such as malloc or
> > the calls in setup_nic, which switch to secondary mode.
> 
> Ok, should I call it laterly? It is just for detect mode switch
> reason in fact

How to use PTHREAD_WARNSW is thoroughly documented, see:
https://xenomai.org/2014/06/finding-spurious-relaxes/

-- 
                                            Gilles.

_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai

Reply via email to