Opened 20 years ago

Closed 17 years ago

#133 closed Bugs (None)

thread_cleanup problems

Reported by: nobody Owned by: Roland Schwarz
Milestone: Component: threads
Version: None Severity:
Keywords: Cc:

Description

Compiling for as a library using CodeWarrior 8.3 
running MacOS 9.2.2, many compile-time errors 
with "thread_cleanup.cpp". The modifications 
shown below get rid of the compile-time errors 
(indicated by //eg), but I'm not sure if they are the 
right way to handle things.

// Copyright (C) 2001
// Mac Murrett
//
// Permission to use, copy, modify, distribute and 
sell this software
// and its documentation for any purpose is hereby 
granted without fee,
// provided that the above copyright notice appear in 
all copies and
// that both that copyright notice and this 
permission notice appear
// in supporting documentation.  Mac Murrett makes 
no representations
// about the suitability of this software for any 
purpose.  It is
// provided "as is" without express or implied 
warranty.
//
// See http://www.boost.org for most recent version 
including documentation.

#include "thread_cleanup.hpp"

#include <Multiprocessing.h>	//eg
#include <cassert>				//eg


namespace boost {

namespace threads {

namespace mac {

namespace detail {


namespace {

TaskStorageIndex g_ulIndex(0UL);

} // anonymous namespace


void do_thread_startup()
{
    if(g_ulIndex == 0UL)
    {
        OSStatus lStatus = 
MPAllocateTaskStorageIndex(&g_ulIndex);
        assert(lStatus == noErr);
    }
    set_thread_cleanup_task(NULL);
}

void do_thread_cleanup()
{
//eg	void (*pfnTask)() = 
MPGetTaskValue(g_ulIndex);
//eg	New function name shown in Multiprocessing 
API version 2.4
    void (*pfnTask)() = (void (*)()) 
MPGetTaskStorageValue(g_ulIndex);	//eg
}


void set_thread_cleanup_task(void (*pfnTask)())
{
 //eg   lStatus = MPSetTaskValue(g_ulIndex, 
reinterpret_cast<TaskStorageValue>(pfnTask));
    OSStatus lStatus = 
MPSetTaskStorageValue(g_ulIndex, 
reinterpret_cast<TaskStorageValue>(pfnTask));	
//eg
    assert(lStatus == noErr);
}


} // namespace detail

} // namespace mac

} // namespace threads

} // namespace boost

Change History (2)

comment:1 by nobody, 17 years ago

Logged In: NO 

It should be noted that nothing has changed in this regard in boost 1.33.1. In 
fact, it seems even more parts of Mac Carbon thread support in boost are now 
completely broken. It would be nice if it either be removed or fixed, the current 
state is just frustrating. I.e. the above mentioned errors are *syntax* erros (i.e. 
in do_thread_cleanup) resulting from plain wrong Carbon API function names, 
missing (!!!) local variables, illegal casts, and so on. Clearly the code can never 
have compiled this way before.

comment:2 by Roland Schwarz, 17 years ago

Status: assignedclosed
Logged In: YES 
user_id=541730

This bug is beeing closed, since support for MPTasks is
beeing dropped. Users are encouraged to use boost.thread on
pthreads, which is available on the newer platforms.

Note: See TracTickets for help on using tickets.