This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: port of omniorb

I had a closer look at OmniORB's source file.

There is a macro "PthreadSupportThreadPriority" which toggles use of thread
priority. If undefined,following functions are never needed:
> pthread_attr_setprio
> pthread_attr_setschedparam
> pthread_setprio
> pthread_setschedattr
> pthread_setschedparam

Here are the functions that are always needed:
X> pthread_cond_broadcast
X> pthread_cond_destroy
X> pthread_cond_signal
X> pthread_cond_timedwait
X> pthread_cond_wait
X> pthread_exit
O> pthread_setspecific
X> pthread_mutex_lock
X> pthread_mutex_unlock
X> pthread_self
X> pthread_mutex_destroy
X> pthread_join

The following are available on some OS's only. Alternatives for other OS's
are given, just have to choose the right one.
> pthread_get_expiration_np
> pthread_delay_np

These are used only if we have a pthread draft 4 implementation:
> pthread_attr_create
> pthread_attr_delete
??> pthread_keycreate

Otherwise these are used instead:
X> pthread_attr_destroy
X> pthread_attr_init
O> pthread_key_create

The following have different calling conventions along different versions of
the pthread draft:
X> pthread_create (draft 4: second arg is pthread_attr_t, otherwise
pthread_attr_t *)
X> pthread_detach (draft <= : arg is pthread_t *, otherwise pthread_t)
O> pthread_getspecific (draft <= 6: void return type, needs second arg of
type void **; draft > 6: void * return type, no second arg)
X> pthread_yield (if draft == 6: called with NULL arg, elif draft < 9: no
arg, else: call sched_yield)

These two are called with second arg = 0 for draft version != 4. With draft
version 4 the second arg is
X> pthread_cond_init
X> pthread_mutex_init

This one is used only if draft version == 8:
X> pthread_attr_setdetachstate

This one is used only if NeedPthreadInit is defined 
> pthread_init

This one, the only you marked as "can't be done", is used only if
C> pthread_attr_setstacksize

Which pthread draft version do we have on Cygwin?  At least 8, I think...

Undefining the NoNanoSleep macro gets rid of pthread_delay_np. This forces
use of the nanosleep function instead in omni_thread::sleep.

Nothing has to be done to get rid of pthread_get_expiration_np. Use of
clock_gettime in omni_thread::get_time will happen automatically.

So for building OmniORB one has to
	- undefine PthreadSupportThreadPriority
	- undefine NeedPthreadInit
	- define PthreadDraftVersion to 8(?)
	- undefine NoNanoSleep
in the makefile.

This is done by setting
OMNITHREAD_POSIX_CPPFLAGS = -UPthreadSupportThreadPriority -UNeedPthreadInit
-DPthreadDraftVersion=8 -UNoNanoSleep
in the platform specific makefile.

The only change which is necessarily needed in is to change line
537 from

#if !defined(__linux__)


#if !defined(__linux__) && !defined(__CYGWIN__)

Hope this helps...


Want to unsubscribe from this list?
Check out:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]