boostorg / boostorg/fiber

Not able to close a library that work with fiber scheduler algorithm or this_fiber

Đang mở
#257 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
510
Fork
123
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I am developing a library which use boost fiber. There I used this_fiber::get_id(), But as soon as I specify this statement I am not able to close the library. Same happens when I specified "boost::fibers::use_scheduling_algorithm< priority_scheduler >();"

Here is the small test case to recreate the scenario
liba.so created from bellow code with -fno-unique-symbols enabled

#include
#include
using namespace std;

int func1(int)
{
cout << "this fiber id " << boost::this_fiber::get_id() << endl; // if this line is commented out then the problem resolved.
cout << "It is a func1" << endl;
return 1;
}
----------
main code from where the library gets loaded
#include
#include
#include
#include
using namespace std;
int fun(string & flName) {
void *handle;
typedef int (*fn)(int);
fn fn1;
handle = dlopen(flName.c_str(), RTLD_LOCAL|RTLD_LAZY);
fn1 = (fn)dlsym(handle, "_Z5func1i");
(*fn1)(2);
cout << "handle :" << handle << endl;
int ext_code = dlclose(handle);
printf ("end exit code %d\n", ext_code);
}

int main(void) {
std::string fileName("dirpath/liba.so");
fun(fileName);
fun(fileName);
fun(fileName);
return 0;
}

Output.
output, when this_fiber is commented out

handle : 0x234567
end exit code 0
handle :0x345678
end exit code 0
handle : 0x456789
end exit code 0
----- but when this_fiber::get_id() is active then

handle : 0x234567
end exit code 0
handle :0x234567
end exit code 0
handle : 0x234567
end exit code 0

How can I deal with this scenario so that dlclose can successfully close the library and release the library handle?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.