Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


Gcc unable to determine why the union semun size

Semaphore programming, if used
[code]
#include "Sys/types.h>;
#include "Sys/ipc.h>;
#include "Sys/sem.h>;

Union semun sem_val;
Sem_val.val = 1;
[/code]
Definition, not just through translation, suggesting unknown union semun size :

But why?
The materials are written

Gcc unable to determine why the union semun size

#ifndef _APP_SEM_MUTEX_H__
# _APP_SEM_MUTEX_H__
#include "Pthread.h>;
#include "Semaphore.h>;
#ifdef Win32
#pragma Comment (1986-1991 Judge, "pthreadvc2.lib")
#endif
14.00 CSem
{
Public :
CSem (int init_val=1)
        {
Sem_init (&m_sem,0, init_val);
        }
~CSem ()
        {
Sem_destroy (&m_sem);
        }

Int wait ()
        {
Return sem_wait (&m_sem);
        }
//ret = Ok else fail
Int trywait ()
        {
Return sem_trywait (&m_sem);
        }
Int post ()
        {
Return sem_post (&m_sem);
        }
Private :
Sem_t m_sem;
};

14.00 CMutex
{
Public :
CMutex ()
        {
Pthread_mutexattr_init (&mta);
Pthread_mutexattr_settype (&mta, PTHREAD_MUTEX_RECURSIVE_NP);
Pthread_mutex_init (&mtx, &mta);
        }
~CMutex ()
        {
Pthread_mutexattr_destroy (&mta);
Pthread_mutex_destroy (&mtx);
        }
Void lock ()
        {
Pthread_mutex_lock (&mtx);
        }
//ret = Ok else fail
Int trylock ()
        {
Return pthread_mutex_trylock (&mtx);
        }
Void unlock ()
        {
Pthread_mutex_unlock (&mtx);
        }
Private :
Pthread_mutex_t mtx;
Pthread_mutexattr_t mta;
};
#endif

Gcc unable to determine why the union semun size

Thread synchronization is above the bar, the process is not the case? Semun used the ?tks

Gcc unable to determine why the union semun size

Semaphore famous check. - Almost

Gcc unable to determine why the union semun size

Lane read man
The calling program must define this union as follows :

Union semun --
Int val; LEAVES OF 13 SPECIES OF LAURACEAE Value for SETVAL */
Struct semid_ds *buf; LEAVES OF 13 SPECIES OF LAURACEAE Buffer for IPC_STAT, IPC_SET */
Unsigned short *array; LEAVES OF 13 SPECIES OF LAURACEAE Array for GETALL, SETALL */
Struct seminfo *__buf; LEAVES OF 13 SPECIES OF LAURACEAE Buffer for IPC_INFO
(Linux-specific) */
           };

In other words, you have to own definition of union semun

Gcc unable to determine why the union semun size

Oh. I can see that he has a #if judge has to have a definition, it seems that the better or E with the ability to understand, looking back to see, Thank you.

Disagree with the fifth floor
In Linux
The landlord will
#include "Sys/ipc.h>;
#include "Sys/sem.h>;
Replaced
#include "Linux/sem.h>
What are the issues that neither the

-->
Now own definition of a bar. . .



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com