mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-users] [patch #4358] Add thread support for MinGW


From: z
Subject: [Mldonkey-users] [patch #4358] Add thread support for MinGW
Date: Fri, 26 Aug 2005 20:51:27 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)

URL:
  <http://savannah.nongnu.org/patch/?func=detailitem&item_id=4358>

                 Summary: Add thread support for MinGW
                 Project: mldonkey, a multi-networks file-sharing client
            Submitted by: zet
            Submitted on: Fri 08/26/05 at 20:51
                Category: None
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open

    _______________________________________________________

Details:


This patch fixes two bugs in thread code
which prevented pthreads from running on mingw.

It also adds pthread static library support for mingw
(start/exit external calls to initialize the library)

Mldonkey currently uses 2 threads: a hasher thread
and a namelookup thread.

Installation in MSYS:


0. cd /usr/src

1. Download pthreads-win32 from http://sourceware.org/pthreads-win32/
wget
ftp://sources.redhat.com/pub/pthreads-win32/pthreads-w32-2-7-0-release.tar.gz

2. tar -zxvf pthreads-w32-2-7-0-release.tar.gz
3. cd pthreads-w32-2-7-0-release
4. make clean GC-static

5. cp libpthreadGC2.a /mingw/lib/libpthread.a
6. cp pthread.h /mingw/include/pthread.h

Now build MLDONKEY

7. cd ~/mldonkey
8. CFLAGS="-O2 -DPTW32_STATIC_LIB" LIBS=-lwsock32 ./configure
9. make mlnet.static
10. mv mlnet.static mlnet.exe


---

Notes:

MinGW doesn't seem to support signal disabling like
pthread_sigmask/sigfillset so they are defined out.

The aclocal macro ACX_PTHREAD is hardcoded to look
for certain thread libraries. pthreadGC2 is not one
of them, so it was renamed to libpthread as above.
This library has calls to 2 functions in wsock32, so
the "-lwsock32" is required.  (step #8 above)

This pthread library can be compiled dynamically,
but a define of PTW32_STATIC_LIB was added to os_stubs.h
for the moment if using mingw since everything else seems
to be statically compiled with mingw.  WSOCK32 was already
a dependency.

(use "objdump -p mlnet.exe | grep DLL" to see dependencies)

"make ed2k_hash" won't work without adding -lwsock32 to
config/Makefile.config: PTHREAD_LIBS=-lpthread -lwsock32


Someone better at Makefile magic can hopefully handle all
this to make it a cleaner config/install process.

Tested for 5 minutes on XP...






    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 08/26/05 at 20:51  Name: pthreads.diff  Size: 6.04KB   By: zet

<http://savannah.nongnu.org/patch/download.php?item_id=4358&item_file_id=5085>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?func=detailitem&item_id=4358>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]